Pandas - Missing Data
Create a dataframe with nan values
dropna
drop rows that have null values
drop columns that have null values
dropna -- thresh -- drop rows or columns with atleast thresh NA values
fillna -- value
Fill NA values with mean of A column
import numpy as np
import pandas as pd
d = {'A':[1,2,np.nan],'B':[5,np.nan,np.nan],'C':[1,2,3]}
df = pd.DataFrame(d)
print(df)
df.dropna()
df.dropna(axis=1)
df.dropna(thresh=2)
df.fillna(value=10)
df['A'].fillna(value=15)
df
df['A'].fillna(value=df['A'].mean())