pandas change nan to mean code example
Example 1: pandas to convert null values to mean in numeric column
df.fillna(df.mean(), inplace=True)
Example 2: python fillna with mean in a dataframe
df["newColumName"] = df["originalColumnName"].fillna(df["originalColumnName"].mean())