I would like to know if there is a clean way to handle nan in numpy.
my_array1=np.array([5,4,2,2,4,np.nan,np.nan,6])
print my_array1
#[ 5. 4. 2. 2. 4. nan nan 6.]
print set(my_array1)
#set([nan, nan, 2.0, 4.0, 5.0, 6.0])
I would have thought it should return at most 1 nan value. Why does it return multiple nan values? I would like to know how many unique non nan values I have in a numpy array.
Thanks