["python","pandas","dataframe","nan"]
How to check if particular value (in cell) is NaN in pandas DataFrame?

Let's say I have the following pandas DataFrame: import pandas as pd import numpy as np df = pd.DataFrame({"A": [1, np.nan, 2], "B": [5, 6, 0]}) Which would look like: >>> df A B 0 1.0 5 1 NaN 6 2 2.0 0 First option I know one way to check if a particular value is NaN: >>> df.isnull().iloc[1,0] True But this checks the whole dataframe just to get one value, so I imagine it's wasteful. Second option (not working) I thought below option, using iloc, would work as well, but it doesn't: >>> df.iloc[1,0] == np.nan False However if I check that value I get: >>> df.iloc[1,0] nan So, why is the second option not working? Is it possible to check for NaN values using iloc? Editor's note: This question previously used pd.np instead of np and .ix in addition to .iloc, but since these no longer exist, they have been edited out to keep it short and clear.
Try pd.isna(): In [7]: pd.isna(df.iloc[1,0]) Out[7]: True AKA pd.isnull