find nan in numpy dataframe code example
Example 1: dataframe find nan rows
df[df.isnull().any(axis=1)]
Example 2: to detect if a data frame has nan values
> df.isnull().any().any()
True
Example 3: numpy find rows containing nan
# in each case returns array of bool
np.isnan(a).any(axis=1) # rows where any value is nan
np.isnan(a).all(axis=1) # rows where all values are nan