I have this data and code:
prices_df = [1106, 1098, 1090.625, 1082.577, 1074.52]
future_dates = {'Date': ['2022-05-02', '2022-05-03', '2022-05-04', '2022-05-05', '2022-05-06'],
'High': [1020, 1005, 966, 2100, 2000],
}
future_prices = pd.DataFrame(future_dates)
future_prices = future_prices.set_index('Date')
df3.loc[i, 'Break_date'] = (future_dates.High > prices_df).idxmax() if any(future_dates.High > prices_df) else 0
The last line of code give me the Date when a High in future dates is higher than prices_df. I also want to save High from future_dates in a new 'Break_price' column, so I want to save the whole row of future_dates ('Date', 'High') where the condition is met. How can I do that?
df3.loc[i, 'Break_price'] = ???
Thank you all