pandas groupby resample leads to missing data

Viewed 129

I have some data that is based on every 3 hours and I try to resample it by using

df = df.groupby(df.index.date).resample('1h').pad()

however it stops at the last data at 21:00 everyday and the last three hours are not there. How should I solve this?

1 Answers

You could use DataFrame.asfreq

df.asfreq('H').groupby(df.index.date).resample('H').pad()
Related