"exploding" (or resampling) a dataframe/series with interval index

Viewed 131

I have a series with an IntervalIndex

|                                            |     sq |
|:-------------------------------------------|-------:|
| (2020-02-03 09:40:00, 2020-02-03 9:50:00]  | 286747 |
| (2020-02-03 10:55:00, 2020-02-03 11:10:00] | 617961 |
| (2020-02-03 11:05:00, 2020-02-03 11:20:00] | 471782 |

I want to explode it into 5-minute intervals (overlapping), kind of how I would use resampling on a regular date/time index. Desired results:

|                                            |     sq |
|:-------------------------------------------|-------:|
| (2020-02-03 09:40:00, 2020-02-03 9:45:00]  | 286747 |
| (2020-02-03 09:45:00, 2020-02-03 9:50:00]  | 286747 |
| (2020-02-03 10:55:00, 2020-02-03 11:00:00] | 617961 |
| (2020-02-03 11:00:00, 2020-02-03 11:05:00] | 617961 |
| (2020-02-03 10:05:00, 2020-02-03 11:10:00] | 617961 |
| (2020-02-03 11:05:00, 2020-02-03 11:10:00] | 471782 |
| (2020-02-03 11:10:00, 2020-02-03 11:15:00] | 471782 |
| (2020-02-03 11:15:00, 2020-02-03 11:20:00] | 471782 |
0 Answers
Related