Examples

In [1]:
import numpy as np
import pandas as pd
In [2]:
s = pd.Series([2., 3., np.nan])
s
Out[2]:
0    2.0
1    3.0
2    NaN
dtype: float64

Drop NA values from a Series.

In [3]:
s.dropna()
Out[3]:
0    2.0
1    3.0
dtype: float64

Keep the Series with valid entries in the same variable.

In [4]:
s.dropna(inplace=True)
s
Out[4]:
0    2.0
1    3.0
dtype: float64

Empty strings are not considered NA values. None is considered an NA value.

In [5]:
s = pd.Series([np.NaN, 2, pd.NaT, '', None, 'I am'])
s
Out[5]:
0     NaN
1       2
2     NaT
3        
4    None
5    I am
dtype: object
In [6]:
s.dropna()
Out[6]:
1       2
3        
5    I am
dtype: object