問題:
In Python Pandas, what's the best way to check whether a DataFrame has one (or more) NaN values?在 Python Pandas 中,檢查 DataFrame 是否具有一個(或多個)NaN 值的最佳方法是什麼?
I know about the function pd.isnan
, but this returns a DataFrame of booleans for each element.我知道函數pd.isnan
,但這會爲每個元素返回一個布爾值的 DataFrame 。 This post right here doesn't exactly answer my question either. 這篇文章也沒有完全回答我的問題。
解決方案:
參考一: https://stackoom.com/question/1zuA4參考二: How to check if any value is NaN in a Pandas DataFrame