I have a few set of data where the index is based on 30min data from monday to friday. There might some missing dates (Might be because of holidays).
Below are the desired output
Looking for last week (ie from 11th july 22 to 15th july 22) and get the low related to the 30min highest high. which occurred on 12-07-2022 09:15:00
A new column which populates all the low for last week(30 min interval) with the values 369.2 (green in color) for this week and 370.05(Orange in color) for last week (Whose value is derived as low of the 30min highest high of week 4th july to 8th july)
there might be missing dates (because of data unavailable) but still for the whole last week 30 min highest high is 376.25 and its corresponding low is 369.2 which needs to be populated for the this df[“Previous week corresponding low of the 30min highest high”]
I just converted the below data set into a dataframe. After not getting how to get to result , what should be done. Basically i am new to python(just 1 month).
Below is the data set to test. datetime is the index. I used df.reset_index(inplace=True) for converting the datetime index as a column.
@ragsfdc, posting your data as data (text) is much appreciated. Please fence it with triple backticks (top left on U.S. keyboard) so it appears in a scrollable frame:
```
<data here>
```
That also adds other benefits like a ‘copy’ function button.
If what you’re asking is to get df["low"] at the row for which df["high"] is the maximum, then it is quite streightforward with Pandas. First, you need to get the row index of the maximum value of the "high" column, which you can do with the df.idxmax method. Then, just get the row of the "low" column if
Also, did you try simply searching for the problem? As a beginner, someone else has already solved almost anything you might be asking already, and searching is a critical important skill for a programming, not to mention both quicker for you and for us. The very first result for get row with max value in data frame seemed quite helpful.