In [1]:
import numpy as np
import pandas as pd
In [2]:
dist1={'A':[1,2,np.nan],'B':[5,np.nan,np.nan],'C':[1,2,3]}
In [3]:
dist1
Out[3]:
In [4]:
df = pd.DataFrame(dist1)
In [5]:
df
Out[5]:
In [7]:
df.dropna(axis=1)
Out[7]:
In [12]:
df.dropna(thresh=2,axis=1)
Out[12]:
In [14]:
df.fillna(value=8)
Out[14]:
In [15]:
df
Out[15]:
In [16]:
df['A']
Out[16]:
In [17]:
df['A'].fillna(value=df['A'].mean())
Out[17]:
No comments:
Post a Comment