-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
DEPR: Deprecate using xlrd engine for read_excel #35029
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
Changes from 1 commit
3a76a36 101aa97 081ecf8 ada4354 3233381 0f4c8a1 499f9a0 825c61c 88093f6 44f157b fffbacb bb53725 d8dcb04 f9876dd bc3ec47 fe10a89 File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -102,10 +102,15 @@ | |
| If io is not a buffer or path, this must be set to identify io. | ||
| Supported engines: "xlrd", "openpyxl", "odf", "pyxlsb", default "xlrd". | ||
| Engine compatibility : | ||
| - "xlrd" supports most old/new Excel file formats. | ||
| - "xlrd" supports most old/new Excel file formats but is no longer maintained. | ||
| - "openpyxl" supports newer Excel file formats. | ||
| - "odf" supports OpenDocument file formats (.odf, .ods, .odt). | ||
| - "pyxlsb" supports Binary Excel files. | ||
| | ||
| .. deprecated:: 1.2.0 | ||
| The default value ``None`` is deprecated and will be changed to ``"openpyxl"`` | ||
| ||
| in a future version. Not specifying an engine will raise a FutureWarning. | ||
| | ||
| converters : dict, default None | ||
| Dict of functions for converting values in certain columns. Keys can | ||
| either be integers or column labels, values are functions that take one | ||
| | @@ -881,10 +886,15 @@ class ExcelFile: | |
| Supported engines: ``xlrd``, ``openpyxl``, ``odf``, ``pyxlsb``, | ||
| default ``xlrd`` for .xls* files, ``odf`` for .ods files. | ||
| Engine compatibility : | ||
| - ``xlrd`` supports most old/new Excel file formats. | ||
| - ``xlrd`` supports most old/new Excel file formats but is no longer maintained. | ||
| ||
| - ``openpyxl`` supports newer Excel file formats. | ||
| - ``odf`` supports OpenDocument file formats (.odf, .ods, .odt). | ||
| - ``pyxlsb`` supports Binary Excel files. | ||
| | ||
| .. deprecated:: 1.2.0 | ||
| The default value ``None`` is deprecated and will be changed to | ||
| ``"openpyxl"`` in a future version. Not specifying an engine will | ||
| raise a FutureWarning. | ||
| """ | ||
| | ||
| from pandas.io.excel._odfreader import ODFReader | ||
| | @@ -902,26 +912,21 @@ class ExcelFile: | |
| def __init__( | ||
| self, path_or_buffer, engine=None, storage_options: StorageOptions = None | ||
| ): | ||
| ext = None | ||
| if not isinstance(path_or_buffer, (BufferedIOBase, RawIOBase)): | ||
| ext = os.path.splitext(str(path_or_buffer))[-1][1:] | ||
| | ||
| if engine is None: | ||
| warnings.warn( | ||
| ||
| "The default argument engine=None is deprecated. " | ||
| "Specify the engine argument to suppress this warning.", | ||
| ||
| FutureWarning, | ||
| stacklevel=4, | ||
| ) | ||
| engine = "xlrd" | ||
| if isinstance(path_or_buffer, (BufferedIOBase, RawIOBase)): | ||
| if _is_ods_stream(path_or_buffer): | ||
| engine = "odf" | ||
| else: | ||
| if ext == "ods": | ||
| ext = os.path.splitext(str(path_or_buffer))[-1] | ||
| if ext == ".ods": | ||
| engine = "odf" | ||
| | ||
| elif engine == "xlrd" and ext in ("xlsx", "xlsm"): | ||
| warnings.warn( | ||
| 'The Excel reader engine "xlrd" is deprecated, use "openpyxl" instead. ' | ||
| 'Specify engine="openpyxl" to suppress this warning.', | ||
| FutureWarning, | ||
| stacklevel=2, | ||
| ) | ||
| if engine not in self._engines: | ||
| raise ValueError(f"Unknown engine: {engine}") | ||
| | ||
| | ||

Uh oh!
There was an error while loading. Please reload this page.