2

Hi I wanted to do some work with my binance.com trade exports but it seems as if pandas can't read the orignal nor copies of the original report from binance.

I checked with Nic Scorazzos answer (Python Pandas read_excel returns empty Dataframe) to see if the file is indeed an excel workbook and not a strict open xml spreadsheet but it seems to me that my file is a workbook.

I checked with the file explorer and the default on 'save as' and it both shows 'Microsoft Excel Workbook (.xlsx)'

Resaving the file as a workbook helps but I want to import them to my python code directly without manually working on them.

I'm on OSX with pandas 1.2 and necessary plugins. Pandas reads other .xlxs files normally, it's just with the binance exports

For those who want to know my code

import pandas as pd
import numpy as np

df = pd.read_excel('binanceExport.xlsx')
df

returns

Date(UTC)
---------

which is the first cell in the spreadsheet

whereas

print(df)

returns

Empty DataFrame
Columns: [Date(UTC)]
Index: []

Screenshot of the spreadsheet

EDIT 1: I tried saving it as an Open Strict XML Spreadsheet (the other .xlsx) and python returns an IndexError: list index out of range

strange, I really believed the original to be an OpenStrictXMLSpreadsheet somehow but as it seems it's not...

2
  • Try changing "engine" parameter of read_excel. In particular, try using openpyxl engine, because often it's better at wowrking with newer Excel formats. Commented Jan 20, 2021 at 0:02
  • hi @pavel, it seems to be a bug on openpyxl's side github.com/pandas-dev/pandas/issues/39250 Commented Jan 20, 2021 at 8:13

1 Answer 1

0

Try to put more arguments

df= read_excel('name.xlsx', sheet_name='')

Are the code and the file in the same folder? Try type all path

I thin that the problem is the type of the data. Try to specify to

Sign up to request clarification or add additional context in comments.

1 Comment

I resaved the file as an excel workbook and it solves the problem. But after some digging it seems as it's a Bug on openpyxl's side (see: github.com/pandas-dev/pandas/issues/39250)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.