Skip to content

DOC: Modify pandas.ExcelWriter default engine in docstring (#43359) #43432

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

Merged
merged 3 commits into from
Sep 12, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pandas/io/excel/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ class ExcelWriter(metaclass=abc.ABCMeta):
"""
Class for writing DataFrame objects into excel sheets.

Default is to use xlwt for xls, openpyxl for xlsx, odf for ods.
Default is to use xlwt for xls, xlsxwriter for xlsx, odf for ods.
See DataFrame.to_excel for typical usage.

The writer should be used as a context manager. Otherwise, call `close()` to save
Expand Down Expand Up @@ -721,14 +721,14 @@ class ExcelWriter(metaclass=abc.ABCMeta):
Default usage:

>>> df = pd.DataFrame([["ABC", "XYZ"]], columns=["Foo", "Bar"])
>>> with ExcelWriter("path_to_file.xlsx") as writer:
>>> with pd.ExcelWriter("path_to_file.xlsx") as writer:
... df.to_excel(writer)

To write to separate sheets in a single file:

>>> df1 = pd.DataFrame([["AAA", "BBB"]], columns=["Spam", "Egg"])
>>> df2 = pd.DataFrame([["ABC", "XYZ"]], columns=["Foo", "Bar"])
>>> with ExcelWriter("path_to_file.xlsx") as writer:
>>> with pd.ExcelWriter("path_to_file.xlsx") as writer:
... df1.to_excel(writer, sheet_name="Sheet1")
... df2.to_excel(writer, sheet_name="Sheet2")

Expand All @@ -743,7 +743,7 @@ class ExcelWriter(metaclass=abc.ABCMeta):
... index=["Date", "Datetime"],
... columns=["X", "Y"],
... )
>>> with ExcelWriter(
>>> with pd.ExcelWriter(
... "path_to_file.xlsx",
... date_format="YYYY-MM-DD",
... datetime_format="YYYY-MM-DD HH:MM:SS"
Expand All @@ -752,7 +752,7 @@ class ExcelWriter(metaclass=abc.ABCMeta):

You can also append to an existing Excel file:

>>> with ExcelWriter("path_to_file.xlsx", mode="a", engine="openpyxl") as writer:
>>> with pd.ExcelWriter("path_to_file.xlsx", mode="a", engine="openpyxl") as writer:
... df.to_excel(writer, sheet_name="Sheet3")

You can store Excel file in RAM:
Expand Down