Suppose I have the following data frame:
0 1 2
new NaN NaN
new one one
a b c
NaN NaN NaN
How would I get the number of unique (non-NaN) values in a row, such as:
0 1 2 _num_unique_values
new NaN NaN 1
new one one 2
a b c 3
NaN NaN NaN 0
I suppose it would be something along the lines of:
df['_num_unique_values'] = len(set(df.loc.tolist())) ??