pandas Detecting missing values with np.nan


Example

If you want to detect missings with

df=pd.DataFrame({'col':[1,np.nan]})
df==np.nan

you will get the following result:

col
0    False
1    False

This is because comparing missing value to anything results in a False - instead of this you should use

df=pd.DataFrame({'col':[1,np.nan]})   
df.isnull()

which results in:

col
0    False
1    True