My column looks like this:
XXXXXXXX
NaN
NaN
NaN
YYYYYYYY
NaN
NaN
NaN
Instead of NaN i want to repeat row value untill next value and so on.
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
YYYYYYYY
YYYYYYYY
YYYYYYYY
YYYYYYYY
My column looks like this:
XXXXXXXX
NaN
NaN
NaN
YYYYYYYY
NaN
NaN
NaN
Instead of NaN i want to repeat row value untill next value and so on.
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
YYYYYYYY
YYYYYYYY
YYYYYYYY
YYYYYYYY
df[column].fillna(method="ffill")
Check out the explanation and examples of available methods ({‘backfill’, ‘bfill’, ‘pad’, ‘ffill’, None}) from the doc https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.fillna.html