In [1]:
import numpy as np
import pandas as pd
In [2]:
d = {'a':[1,2,np.nan],'b':[5,np.nan,np.nan],'c':[1,2,3]}
In [4]:
df = pd.DataFrame(d)
df
Out[4]:
In [6]:
df.dropna() # drops all rows with missing values
Out[6]:
In [7]:
df.dropna(axis=1)
Out[7]:
In [8]:
df.fillna('WOOSH')
Out[8]:
In [11]:
df['a'].fillna(df['a'].mean())
Out[11]:
In [ ]: