I have a pandas time series indexed at 15 minute intervals which are timestamps. At each interval, I have multiple columns a
, b
and c
.
| index | a | b | c |
| 9:00 am | 2 | 2 | 4 |
| 9:15 am | 2 | 2 | 4 |
...
I need to compare the average the value of a
at the same time 1, 2, 3 and 4 weeks back to the current timestep. So if my current time is 9:15 am, I need to find the average of a
at 9:15 am from the previous week, 2 weeks, 3 and 4 weeks back.
Obviously this cannot be calculated on the first 4 weeks of the dataset, because there is not enough history. I'm stuck on how to think about shifting the data frame to the past to get those values to aggregate and then compare to the future.
There is some similarity to this question but there the index is not a timeseries, and the comparison is a bit simpler.