replace nan values with average of columns in pandas for a column code example
Example 1: how to fill nas on a dataframe with median
df.fillna(df.mean(), inplace=True)
Example 2: python fillna with mean in a dataframe
df["newColumName"] = df["originalColumnName"].fillna(df["originalColumnName"].mean())