Reputation: 4933
I am getting value of cell as nan
, But when I do cell_value == np.nan
then it's False.
Then I tried to print type(cell_value)
it's giving <class 'float'>
How do I match it ?
Upvotes: 3
Views: 6139
Reputation: 3103
You can't use equality on nan
, you can evaluate it as follows:
np.isnan(np.nan)
#returns True
pd.isnull(np.nan)
#returns True
np.nan == np.nan
#Always returns False
Because nan
is a special floating point value.
Upvotes: 6