Skip to content

Commit

Permalink
Doc: Fix GL08 error for pandas.ExcelFile.book (#57807)
Browse files Browse the repository at this point in the history
* Fix GL08 error for pandas.ExcelFile.book

* fixing NameError("name 'file' is not defined")

* fixing No Such File errors in code example
  • Loading branch information
jordan-d-murphy committed Mar 11, 2024
1 parent 9d1d6f6 commit fd1126c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
1 change: 0 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then

MSG='Partially validate docstrings (GL08)' ; echo $MSG
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=GL08 --ignore_functions \
pandas.ExcelFile.book\
pandas.Index.empty\
pandas.Index.names\
pandas.Index.view\
Expand Down
26 changes: 26 additions & 0 deletions pandas/io/excel/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1631,6 +1631,32 @@ def parse(

@property
def book(self):
"""
Gets the Excel workbook.
Workbook is the top-level container for all document information.
Returns
-------
Excel Workbook
The workbook object of the type defined by the engine being used.
See Also
--------
read_excel : Read an Excel file into a pandas DataFrame.
Examples
--------
>>> file = pd.ExcelFile("myfile.xlsx") # doctest: +SKIP
>>> file.book # doctest: +SKIP
<openpyxl.workbook.workbook.Workbook object at 0x11eb5ad70>
>>> file.book.path # doctest: +SKIP
'/xl/workbook.xml'
>>> file.book.active # doctest: +SKIP
<openpyxl.worksheet._read_only.ReadOnlyWorksheet object at 0x11eb5b370>
>>> file.book.sheetnames # doctest: +SKIP
['Sheet1', 'Sheet2']
"""
return self._reader.book

@property
Expand Down

0 comments on commit fd1126c

Please sign in to comment.