Skip to content

Broken behaviour on read_excel on 0.24.0 #25274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
LPugens opened this issue Feb 11, 2019 · 3 comments
Closed

Broken behaviour on read_excel on 0.24.0 #25274

LPugens opened this issue Feb 11, 2019 · 3 comments
Labels
IO Excel read_excel, to_excel Usage Question

Comments

@LPugens
Copy link

LPugens commented Feb 11, 2019

Code Sample, a copy-pastable example if possible

# Your code here
wget https://github.com/pandas-dev/pandas/files/2852618/file.xlsx
pip install pandas==0.23.4
>>import pandas as pd
>>df = pd.read_excel('file.xlsx', index_row=[0, 1, 2], header=[0, 1, 2])
>>print(df.columns.names)
pip uninstall pandas
pip install pandas==0.24.0
>>import pandas as pd
>>df = pd.read_excel('file.xlsx', index_row=[0, 1, 2], header=[0, 1, 2])
>>print(df.columns.names)

Problem description

The columns names are not identified by versions 0.24+.

Expected Output

Both print lines should print the same thing:
['top_level', 'middle_level', 'low_level']

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]

INSTALLED VERSIONS

commit: None
python: 3.7.1.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: AMD64 Family 23 Model 1 Stepping 1, AuthenticAMD
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.23.4
pytest: None
pip: 18.1
setuptools: 40.6.2
Cython: None
numpy: 1.16.1
scipy: 1.2.1
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.7.5
pytz: 2018.7
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 3.0.2
openpyxl: 2.5.12
xlrd: 1.1.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: 1.2.14
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

INSTALLED VERSIONS

commit: None
python: 3.7.1.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: AMD64 Family 23 Model 1 Stepping 1, AuthenticAMD
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.24.0
pytest: None
pip: 18.1
setuptools: 40.6.2
Cython: None
numpy: 1.16.1
scipy: 1.2.1
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.7.5
pytz: 2018.7
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 3.0.2
openpyxl: 2.5.12
xlrd: 1.1.0
xlwt: None
xlsxwriter: None
lxml.etree: None
bs4: None
html5lib: None
sqlalchemy: 1.2.14
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None

@WillAyd
Copy link
Member

WillAyd commented Feb 12, 2019

There is no such parameter as index_row - are you looking for index_col=0 instead? That seems to get the behavior you are after

Outside of that this is actually expected behavior as a result of #23874. The prior behavior was incorrect because it was not respecting index_col=None being the default and treating the first column as the index without being explicitly stated

@WillAyd WillAyd closed this as completed Feb 12, 2019
@WillAyd WillAyd added Usage Question IO Excel read_excel, to_excel labels Feb 12, 2019
@jorisvandenbossche
Copy link
Member

@LPugens is the answer of @WillAyd satisfying?

There is no such parameter as index_row

But the code above still runs ... We should probably not silently accept any kwarg here.

@LPugens
Copy link
Author

LPugens commented Feb 15, 2019

@jorisvandenbossche yes, somehow my old code was running on luck.
The solution Offered by @WillAyd worked fine.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO Excel read_excel, to_excel Usage Question
Projects
None yet
Development

No branches or pull requests

3 participants