df.isnull().any().any()
This line evaluates to a boolean True/False, as it checks whether a Pandas dataframe contains any NaN's in its rows or columns. Is there a more concise/idiomatic way of checking this?
I think it's to use numpy's any:
In [11]: df = pd.DataFrame([[1, 2], [3, np.nan]])
In [12]: df.isnull().any().any()
Out[12]: True
In [13]: np.any(df.isnull())
Out[13]: True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With