-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
EnhancementError ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandasIO Excelread_excel, to_excelread_excel, to_excelgood first issue
Description
Right now if you don't have xlrd
installed and use read_excel
without specifying the engine
keyword you get the following message:
>>> pd.read_excel("test.xlsx")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/williamayd/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pandas/util/_decorators.py", line 208, in wrapper
return func(*args, **kwargs)
File "/Users/williamayd/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pandas/io/excel/_base.py", line 310, in read_excel
io = ExcelFile(io, engine=engine)
File "/Users/williamayd/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pandas/io/excel/_base.py", line 819, in __init__
self._reader = self._engines[engine](self._io)
File "/Users/williamayd/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pandas/io/excel/_xlrd.py", line 20, in __init__
import_optional_dependency("xlrd", extra=err_msg)
File "/Users/williamayd/.pyenv/versions/3.7.2/lib/python3.7/site-packages/pandas/compat/_optional.py", line 93, in import_optional_dependency
raise ImportError(message.format(name=name, extra=extra)) from None
ImportError: Missing optional dependency 'xlrd'. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.
This is in spite of the fact that the user may have openpyxl installed and could do something like pd.read_excel(..., engine="openpyxl")
to get the same code to work
Two issues need to be addressed here:
- The default
read_excel
call with noengine
argument should fall back toopenpyxl
, if installed - The default error message should direct the user to install openpyxl first and foremost, as xlrd is unmaintained
Metadata
Metadata
Assignees
Labels
EnhancementError ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandasIO Excelread_excel, to_excelread_excel, to_excelgood first issue