<human>:  pandas DataFrame: replace nan values with average of columns
<bot>: Here is some code to replace nan values in a pandas data frame with the average of columns

df.apply(lambda x: x.fillna(x.mean()), axis=0)

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.