The output of the panda's data frame:
Date Time Hi Lo Open Close Volume
0 2021-12-10 4:00 174.80 174.56 174.73 174.8 953
1 2021-12-10 4:01 174.78 174.78 174.78 174.78 100
2 2021-12-10 4:02 174.90 174.75 174.8 174.75 627
3 2021-12-10 4:03 174.93 174.91 174.91 174.93 268
4 2021-12-10 4:04 174.92 174.92 174.92 174.92 300
Code below will get the highest high in the Hi column:
df['Date'] = pd.to_datetime(df['Date'],infer_datetime_format=True)
df = df[(df['Time'] >= "4:01") & (df['Time'] <= "4:04")]['Hi'].max()
From here onwards I'm trying to get the index of the row of where the max value in Hi is positioned.
Code Below Someone recommended:
df.loc[df[(df['Time'] >= "4:01") & (df['Time'] <= "4:04")]['Hi'].idxmax()]
But if I run the code it'll give me this output:
TypeError: reduction operation 'argmax' not allowed for this dtype is the call back
My desired output I want is:
HOD Time is 4:03