Skip to content

Commit fc45c4c

Browse files
jordan-d-murphypmhatre1
authored andcommitted
Doc: Fix GL08 error for pandas.ExcelFile.book (pandas-dev#57807)
* Fix GL08 error for pandas.ExcelFile.book * fixing NameError("name 'file' is not defined") * fixing No Such File errors in code example
1 parent 2a43b03 commit fc45c4c

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

ci/code_checks.sh

-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
144144

145145
MSG='Partially validate docstrings (GL08)' ; echo $MSG
146146
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=GL08 --ignore_functions \
147-
pandas.ExcelFile.book\
148147
pandas.Index.empty\
149148
pandas.Index.names\
150149
pandas.Index.view\

pandas/io/excel/_base.py

+26
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,32 @@ def parse(
16311631

16321632
@property
16331633
def book(self):
1634+
"""
1635+
Gets the Excel workbook.
1636+
1637+
Workbook is the top-level container for all document information.
1638+
1639+
Returns
1640+
-------
1641+
Excel Workbook
1642+
The workbook object of the type defined by the engine being used.
1643+
1644+
See Also
1645+
--------
1646+
read_excel : Read an Excel file into a pandas DataFrame.
1647+
1648+
Examples
1649+
--------
1650+
>>> file = pd.ExcelFile("myfile.xlsx") # doctest: +SKIP
1651+
>>> file.book # doctest: +SKIP
1652+
<openpyxl.workbook.workbook.Workbook object at 0x11eb5ad70>
1653+
>>> file.book.path # doctest: +SKIP
1654+
'/xl/workbook.xml'
1655+
>>> file.book.active # doctest: +SKIP
1656+
<openpyxl.worksheet._read_only.ReadOnlyWorksheet object at 0x11eb5b370>
1657+
>>> file.book.sheetnames # doctest: +SKIP
1658+
['Sheet1', 'Sheet2']
1659+
"""
16341660
return self._reader.book
16351661

16361662
@property

0 commit comments

Comments
 (0)