Skip to content

Commit e0fc50d

Browse files
Change ExcelFile's docstring and read_excel docs in order to add information about engine compatibility and also the support of pyxlsb engine GH34237.
1 parent 1f48d3d commit e0fc50d

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

pandas/io/excel/_base.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"""
3535
Read an Excel file into a pandas DataFrame.
3636
37-
Supports `xls`, `xlsx`, `xlsm`, `xlsb`, and `odf` file extensions
37+
Supports `xls`, `xlsx`, `xlsm`, `xlsb`, `odf`, `ods` and `odt` file extensions
3838
read from a local filesystem or URL. Supports an option to read
3939
a single sheet or a list of sheets.
4040
@@ -103,7 +103,12 @@
103103
of dtype conversion.
104104
engine : str, default None
105105
If io is not a buffer or path, this must be set to identify io.
106-
Acceptable values are None, "xlrd", "openpyxl" or "odf".
106+
Acceptable values are None, "xlrd", "openpyxl", "odf", or "pyxlsb".
107+
Engine compatibility:
108+
"xlrd" supports most old/new Excel file formats.
109+
"openpyxl" engine supports newer Excel file formats.
110+
"odf" engine supports OpenDocument file formats (.odf, .ods, .odt).
111+
"pyxlsb" engine supports Binary Excel files.
107112
converters : dict, default None
108113
Dict of functions for converting values in certain columns. Keys can
109114
either be integers or column labels, values are functions that take one
@@ -784,17 +789,22 @@ def close(self):
784789
class ExcelFile:
785790
"""
786791
Class for parsing tabular excel sheets into DataFrame objects.
787-
Uses xlrd. See read_excel for more documentation
792+
Uses xlrd by default. See read_excel for more documentation
788793
789794
Parameters
790795
----------
791796
io : str, path object (pathlib.Path or py._path.local.LocalPath),
792797
a file-like object, xlrd workbook or openpypl workbook.
793-
If a string or path object, expected to be a path to xls, xlsx or odf file.
798+
If a string or path object, expected to be a path to a
799+
.xls, .xlsx, .xlsb, .xlsm, .odf, .ods, or .odt file.
794800
engine : str, default None
795801
If io is not a buffer or path, this must be set to identify io.
796-
Acceptable values are None, ``xlrd``, ``openpyxl``, ``odf``, or ``pyxlsb``.
797-
Note that ``odf`` reads tables out of OpenDocument formatted files.
802+
Acceptable values are None, ``xlrd``, ``openpyxl``, ``odf``, or ``pyxlsb``.
803+
Engine compatibility:
804+
``xlrd`` supports most old/new Excel file formats.
805+
``openpyxl`` engine supports newer Excel file formats.
806+
``odf`` engine supports OpenDocument file formats (.odf, .ods, .odt).
807+
``pyxlsb`` engine supports Binary Excel files.
798808
"""
799809

800810
from pandas.io.excel._odfreader import _ODFReader
@@ -816,7 +826,8 @@ def __init__(self, io, engine=None):
816826
raise ValueError(f"Unknown engine: {engine}")
817827

818828
self.engine = engine
819-
# could be a str, ExcelFile, Book, etc.
829+
830+
# Could be a str, ExcelFile, Book, etc.
820831
self.io = io
821832
# Always a string
822833
self._io = stringify_path(io)

0 commit comments

Comments
 (0)