I have a time series dataframe of energy consumption.
How can I find the section or window of least variance? Let's say the size of the window is three, how can I get index 3,4,5?
index | time | energy |
---|---|---|
0 | 2021-04-21 16:00:00 | 14 |
1 | 2021-04-21 17:00:00 | 87 |
2 | 2021-04-21 18:00:00 | 3 |
3 | 2021-04-21 19:00:00 | 349 |
4 | 2021-04-21 20:00:00 | 355 |
5 | 2021-04-21 21:00:00 | 350 |
6 | 2021-04-21 22:00:00 | 21 |
I can do this by iterating through the rows, but there is probably a better Pandas way of doing this, right?