Pandas - Using 'ffill' on values other than Na
问题 Is there a way to use ffill method on values that are not NaN ? I have NaN in my dataframe, but I have added these NaN using addNan = sample['colA'].replace(['A'], 'NaN') So this is what my DataFrame, df looks like ColA ColB ColC ColD B A A C NaN B A A C D D A NaN A A B And I'm trying to fill these NaN using ffill , so they are populated by the last known value. fill = df.fillna(method='ffill', inplace = True) This doesn't make a difference, also tried Na instead of NaN 回答1: I think you need