EDIT: This question is not a clone of pandas dataframe replace nan values with average of columns because I want to replace the value of each column with th
To fill NaN of each column with its respective mean use:
NaN
df.apply(lambda x: x.fillna(x.mean()))