1#Python, pandas
2#Count missing values for each column of the dataframe df
3
4df.isnull().sum()
5
1In [1]: s = pd.Series([1,2,3, np.nan, np.nan])
2
3In [4]: s.isna().sum() # or s.isnull().sum() for older pandas versions
4Out[4]: 2
1>>> df = pd.DataFrame({"Person":
2... ["John", "Myla", "Lewis", "John", "Myla"],
3... "Age": [24., np.nan, 21., 33, 26],
4... "Single": [False, True, True, True, False]})
5>>> df
6 Person Age Single
70 John 24.0 False
81 Myla NaN True
92 Lewis 21.0 True
103 John 33.0 True
114 Myla 26.0 False
12
13df.count()
14Person 5
15Age 4
16Single 5
17dtype: int64