1) I have the following 1-minute-frequency-data in a pandas DataFrame:
0 | Open | High | Low | Close | Volume |
---|---|---|---|---|---|
2010-10-19 06:31:00 | 58.75 | 58.81 | 58.58 | 58.59 | 228125 |
2010-10-19 06:32:00 | 58.59 | 58.68 | 58.55 | 58.57 | 153303 |
2010-10-19 06:33:00 | 58.57 | 58.6 | 58.5 | 58.52 | 115647 |
2010-10-19 06:34:00 | 58.52 | 58.58 | 58.48 | 58.58 | 63577 |
2010-10-19 06:35:00 | 58.57 | 58.59 | 58.51 | 58.53 | 111770 |
2) I also have the following index array:
[2010-10-19 06:32:00, 2010-10-19 06:35:00]
3) I want to reindex the DataFrame according to the index array such that the new DataFrame will only have the 2 rows of the index array, while managing to resample it so that the high of the first row of the new dataframe is the higher of the highs from the first 2 rows of the original dataframe, the low of the second row of the new dataframe is the lower of the 3 lows in the original dataframe, etc.
Normally, one would aggregate one's data via .resample() and .agg(), but that's once you already have the dataframe in the state that you want. I can't use reindex() in such a way that I could follow it up with .resample() and accomplish this.
I suppose I'm looking for a way to reindex and resample in one move. How do I best do this?