2

My code (using pandas, pandas_datareader)

info = robinhood.RobinhoodHistoricalReader("AAPL", start=start, end=end, interval="5minute", span="day")
prices = pd.DataFrame(info.read(), columns=['close_price'])
minutes = prices.idxmax(axis=0) * 5

Gives a TypeError: reduction operation 'argmax' not allowed for this dtype

Any idea how to fix this? I just want to find the index of the max price in my dataset.

1 Answers1

1

Try this:

info = robinhood.RobinhoodHistoricalReader("AAPL", start=start, end=end, interval="5minute", span="day")
prices = pd.DataFrame(info.read(), columns=['close_price'])
minutes = prices.astype(float).idxmax(axis=0) * 5

Assumes your row index is numeric. minutes is now a row showing the row_index*5 for the max cell value in each column.