<human>:  How to replace NaNs by preceding values in pandas DataFrame?
<bot>: Here is some code to replace nans by preceding values in pandas dataframe `df`

df.fillna(method='ffill', inplace=True)

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