datetime
2012-01-01 125.5010
2012-01-02 NaN
2012-01-03 125.5010
2013-01-04 NaN
2013-01-05 125.5010
2013-02-28 125.5010
2014-02-28 125.5010
2016-01-02 125.5010
2016-01-04 125.5010
2016-02-28 NaN
I would like to fill in the missig values in this dataframe by using a climatology computed from the dataset i.e fill in missing 28th feb 2016
value by averaging values of 28th feb
from other years. How do i do this?
You can use
groupby
bymonth
andday
andtransform
withfillna
mean
: