Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Python Binance API Function Data Pull

I am trying to write a function that will pull ticker information from Binance and put into a nice chart. I am using pandas and keep getting this error: pandas.core.indexing.IndexingError: Too many indexers

Below is a portion of the code:
enter image description here

def getminutedata(symbol, interval, lookback):
frame = pd.DataFrame(client.get_historical_klines(symbol, interval, lookback + ‘min ago CST’))

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

frame = frame.iloc[:,:,6]

frame.columns = [‘Time’, ‘Open’, ‘High’, ‘Low’, ‘Close’, ‘Volume’]

frame = frame.set_index(‘Time’)

frame.index = pd.to_datetime(frame.index, unit=’ms’)

frame = frame.astype(float)

return frame

df = getminutedata(‘ADAUSDT’, ‘1m’, ’30’)

Is there something I am missing?

>Solution :

Because pandas dataframes are 2-dimensional, you can use at most 2 indexers to index a dataframe. You’re using 3 (:, :, and 6).

Try changing this line:

frame = frame.iloc[:,:,6]

To this:

frame = frame.iloc[:,6]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading