pandas nan python if code example
Example 1: to detect if a data frame has nan values
> df.isnull().any().any()
True
Example 2: check for missing values by column in pandas
df.isna().any()
> df.isnull().any().any()
True
df.isna().any()