count na in pandas code example
Example 1: count nan pandas
df.isnull().sum()
Example 2: python count null values in dataframe
df.isnull().sum().sum()
Example 3: count na pandas
>>> df = pd.DataFrame({"Person":
... ["John", "Myla", "Lewis", "John", "Myla"],
... "Age": [24., np.nan, 21., 33, 26],
... "Single": [False, True, True, True, False]})
>>> df
Person Age Single
0 John 24.0 False
1 Myla NaN True
2 Lewis 21.0 True
3 John 33.0 True
4 Myla 26.0 False
df.count()
Person 5
Age 4
Single 5
dtype: int64