human
Pandas Dataframe: Replacing NaN with row average
assistant
Here is some code to replacing nan in the dataframe `df` with row average

df.fillna(df.mean(axis=1), axis=1)

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