Skip to content

read_excel and ExcelFile engine conflict #26566

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
WillAyd opened this issue May 29, 2019 · 4 comments · Fixed by #26736
Closed

read_excel and ExcelFile engine conflict #26566

WillAyd opened this issue May 29, 2019 · 4 comments · Fixed by #26736
Labels
Error Reporting Incorrect or improved errors from pandas good first issue IO Excel read_excel, to_excel
Milestone

Comments

@WillAyd
Copy link
Member

WillAyd commented May 29, 2019

This is currently valid code:

>>> xl = pd.ExcelFile('foo.xlsx', engine='xlrd')
>>> pd.read_excel(xl, engine='openpyxl')
Empty DataFrame
Columns: []
Index: []

Though ambiguous as to which engine is actually being used. I think we should be raising if an engine is specified in read_excel when the target is a pd.ExcelFile, as the latter is a lower level construct and will already have an engine in place.

@simonjayhawkins

@WillAyd WillAyd added Error Reporting Incorrect or improved errors from pandas IO Excel read_excel, to_excel labels May 29, 2019
@WillAyd WillAyd added this to the Contributions Welcome milestone May 29, 2019
@WillAyd
Copy link
Member Author

WillAyd commented May 29, 2019

To clarify I suppose this isn’t ambiguous now since xlrd is our only reader but will be once that doesn’t hold true. May be a similar issue on the write side

@alimcmaster1
Copy link
Member

Makes sense to me - happy to take a look

@sumanau7
Copy link
Contributor

sumanau7 commented Jun 6, 2019

Isn't this a documentation issue, because only when input to read_excel is not an instance of ExcelFile, then only engine argument given to read_excel will be used, in all other cases, engine argument has no impact whatsoever.
https://github.com/pandas-dev/pandas/blob/master/pandas/io/excel/_base.py#L290
@WillAyd

@alimcmaster1
Copy link
Member

alimcmaster1 commented Jun 6, 2019 via email

@jreback jreback modified the milestones: Contributions Welcome, 0.25.0 Jun 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas good first issue IO Excel read_excel, to_excel
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants