From 6bb8dd53aa2801fb43200b6952c88bff5284d18e Mon Sep 17 00:00:00 2001 From: yuanx749 Date: Mon, 15 Jan 2024 12:51:03 +0800 Subject: [PATCH 1/2] DOC: fix EX03 in pandas.ExcelWriter --- ci/code_checks.sh | 2 +- pandas/io/excel/_base.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 8658715b8bf3e..ffd343ccf8789 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -86,7 +86,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.Timestamp.ceil \ pandas.Timestamp.floor \ pandas.Timestamp.round \ - pandas.ExcelWriter \ + pandas.read_pickle \ pandas.read_json \ pandas.io.json.build_table_schema \ pandas.io.formats.style.Styler.to_latex \ diff --git a/pandas/io/excel/_base.py b/pandas/io/excel/_base.py index 786f719337b84..4b01514728f68 100644 --- a/pandas/io/excel/_base.py +++ b/pandas/io/excel/_base.py @@ -1031,7 +1031,7 @@ class ExcelWriter(Generic[_WorkbookT]): Here, the `if_sheet_exists` parameter can be set to replace a sheet if it already exists: - >>> with ExcelWriter( + >>> with pd.ExcelWriter( ... "path_to_file.xlsx", ... mode="a", ... engine="openpyxl", @@ -1042,7 +1042,8 @@ class ExcelWriter(Generic[_WorkbookT]): You can also write multiple DataFrames to a single sheet. Note that the ``if_sheet_exists`` parameter needs to be set to ``overlay``: - >>> with ExcelWriter("path_to_file.xlsx", + >>> with pd.ExcelWriter( + ... "path_to_file.xlsx", ... mode="a", ... engine="openpyxl", ... if_sheet_exists="overlay", From 5901999f08a048f7b383ab2981099bc56e3d3737 Mon Sep 17 00:00:00 2001 From: yuanx749 Date: Mon, 15 Jan 2024 13:03:24 +0800 Subject: [PATCH 2/2] xref --- ci/code_checks.sh | 1 - pandas/io/excel/_base.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index ffd343ccf8789..4bf6a3e97f0c6 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -86,7 +86,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.Timestamp.ceil \ pandas.Timestamp.floor \ pandas.Timestamp.round \ - pandas.read_pickle \ pandas.read_json \ pandas.io.json.build_table_schema \ pandas.io.formats.style.Styler.to_latex \ diff --git a/pandas/io/excel/_base.py b/pandas/io/excel/_base.py index 4b01514728f68..2189f54263dec 100644 --- a/pandas/io/excel/_base.py +++ b/pandas/io/excel/_base.py @@ -935,7 +935,7 @@ class ExcelWriter(Generic[_WorkbookT]): is installed otherwise `openpyxl `__ * `odswriter `__ for ods files - See ``DataFrame.to_excel`` for typical usage. + See :meth:`DataFrame.to_excel` for typical usage. The writer should be used as a context manager. Otherwise, call `close()` to save and close any opened file handles.