Given a dataframe and a specific index whose type is DateTimeIndex, how can we retrieve the value associated with that index?
Consider the the following code where we have the index of a maximum in a certain range:
index = pd.date_range('7-20-2022', '7-21-2022', freq='min')
np.random.seed(0)
df = pd.DataFrame(np.cumsum(np.random.randn(len(index))), index=index)
df_limited = df.loc['7-20-2022'].between_time('14:00', '15:00')
idx = df_limited.idxmax()
What is the value at idx?
None of max=df_limited.loc[idx], max=df_limited.iloc[idx], or max = df_limited[(df_limited.index == idx)] work.