pandas df has nan code example
Example 1: to detect if a data frame has nan values
> df.isnull().any().any()
True
Example 2: to detect if a data frame has nan values
df.isnull().sum().sum()
5
> df.isnull().any().any()
True
df.isnull().sum().sum()
5