I have some hourly data, such as below, with odd sample times.
| # | Date Time, GMT-08:00 | Temp, °C |
|---|---|---|
| 1 | 10/31/23 15:51 | 13.41 |
| 2 | 10/31/23 16:51 | 7.49 |
| 3 | 10/31/23 17:51 | 7.61 |
| 4 | 10/31/23 18:51 | 7.39 |
| 5 | 10/31/23 19:51 | 7.34 |
| 6 | 10/31/23 20:51 | 7.33 |
| 7 | 10/31/23 21:51 | 7.38 |
I would like to resample with interpolation so the data points occur on the hour. I.e. 1500, 1600, 1700...
I assumed the following would work, but I've been unable to make this do what I expected.
df.resample('60min').first().interpolate('linear')
IIUC:
df.resampleto resample your series into 1 minute bins ('T'), get.first, and apply linear interpolation (.interpolate),method='linear'being the default.'H'), and apply.asfreq.