replace nan with mean
df.fillna(df.mean())
Source: stackoverflow.com
how to fill missing values dataframe with mean
sub2['income'].fillna((sub2['income'].mean()), inplace=True)