df['DataFrame Column'] = df['DataFrame Column'].fillna(0)
df.replace(np.nan,0)
# Replacing all nan values with 0 in Dataframe
df = df.fillna(0)
#fill nan values with mean
df = df.fillna(df.mean())
>>> df = pd.DataFrame([[1, 2, 3], [4, None, None], [None, None, 9]])
>>> df.fillna(method='ffill')
0 1 2
0 1 2 3
1 4 2 3
2 4 2 9
#fill nan values with mean
df = df.fillna(df.mean())
import pandas as pd
import numpy as np
df = pd.DataFrame({'col1':['one', 'two', 'three', 'four']})
df['col1'] = df['col1'].map(lambda x: np.nan if x in ['two', 'four'] else x)