Skip to content
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

read_excel and ExcelFile engine conflict #26566

Closed
WillAyd opened this issue May 29, 2019 · 4 comments

Comments

@WillAyd
Copy link
Member

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

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link
Contributor

commented Jun 5, 2019

Makes sense to me - happy to take a look

@sumanau7

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.