试试这个:
In [71]: df Out[71]: a b c 0 NaN 7.0 0 1 0.0 NaN 4 2 2.0 NaN 4 3 1.0 7.0 0 4 1.0 3.0 9 5 7.0 4.0 9 6 2.0 6.0 9 7 9.0 6.0 4 8 3.0 0.0 9 9 9.0 0.0 1 In [72]: pd.isnull(df).sum() Out[72]: a 1 b 2 c 0 dtype: int64
要么:
In [76]: df.isnull().sum() Out[76]: a 1 b 2 c 0 dtype: int64
你可以用它创建一个DF:
In [78]: df.isnull().sum().to_frame('nulls') Out[78]: nulls a 1 b 2 c 0