Count the number of NaN's

In [6]:
from pandas import DataFrame
import numpy as np

Create a pandas DataFrame.

In [7]:
df = DataFrame({'a': [8, np.nan, 23], 
                'b': [7, 8, 4], 
                'c': [400, 83, 98]},
                index=["one", "two", "three"])
df
Out[7]:
a b c
one 8.0 7 400
two NaN 8 83
three 23.0 4 98

Count the number of NaN's in each column.

In [9]:
df.isnull().sum()
Out[9]:
a    1
b    0
c    0
dtype: int64

Count the number of NaN's in each row.

In [11]:
df.isnull().sum(axis=1)
Out[11]:
one      0
two      1
three    0
dtype: int64