Skip to content

Commit bdb81b9

Browse files
LiquidMikaAlexeyGy
authored andcommitted
DOC: Modify pandas.ExcelWriter default engine in docstring (pandas-dev#43359) (pandas-dev#43432)
* DOC: Modify pandas.ExcelWriter default engine in docstring (pandas-dev#43359) * engine for xlsx : xlsxwriter instead of openpyxl * correction to pass the doctest * DOC: Modify pandas.ExcelWriter default engine in docstring (pandas-dev#43359) Correction after after pull review * engine for xlsx : xlsxwriter instead of openpyxl * correction to pass the doctest * DOC: Modify pandas.ExcelWriter default engine in docstring (pandas-dev#43359) Correction to pass test * engine for xlsx : xlsxwriter instead of openpyxl * correction to pass the doctest
1 parent 4a78a82 commit bdb81b9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pandas/io/excel/_base.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,10 @@ class ExcelWriter(metaclass=abc.ABCMeta):
653653
"""
654654
Class for writing DataFrame objects into excel sheets.
655655
656-
Default is to use xlwt for xls, openpyxl for xlsx, odf for ods.
656+
Default is to use :
657+
* xlwt for xls
658+
* xlsxwriter for xlsx if xlsxwriter is installed otherwise openpyxl
659+
* odf for ods.
657660
See DataFrame.to_excel for typical usage.
658661
659662
The writer should be used as a context manager. Otherwise, call `close()` to save
@@ -727,14 +730,14 @@ class ExcelWriter(metaclass=abc.ABCMeta):
727730
Default usage:
728731
729732
>>> df = pd.DataFrame([["ABC", "XYZ"]], columns=["Foo", "Bar"])
730-
>>> with ExcelWriter("path_to_file.xlsx") as writer:
733+
>>> with pd.ExcelWriter("path_to_file.xlsx") as writer:
731734
... df.to_excel(writer)
732735
733736
To write to separate sheets in a single file:
734737
735738
>>> df1 = pd.DataFrame([["AAA", "BBB"]], columns=["Spam", "Egg"])
736739
>>> df2 = pd.DataFrame([["ABC", "XYZ"]], columns=["Foo", "Bar"])
737-
>>> with ExcelWriter("path_to_file.xlsx") as writer:
740+
>>> with pd.ExcelWriter("path_to_file.xlsx") as writer:
738741
... df1.to_excel(writer, sheet_name="Sheet1")
739742
... df2.to_excel(writer, sheet_name="Sheet2")
740743
@@ -749,7 +752,7 @@ class ExcelWriter(metaclass=abc.ABCMeta):
749752
... index=["Date", "Datetime"],
750753
... columns=["X", "Y"],
751754
... )
752-
>>> with ExcelWriter(
755+
>>> with pd.ExcelWriter(
753756
... "path_to_file.xlsx",
754757
... date_format="YYYY-MM-DD",
755758
... datetime_format="YYYY-MM-DD HH:MM:SS"
@@ -758,7 +761,7 @@ class ExcelWriter(metaclass=abc.ABCMeta):
758761
759762
You can also append to an existing Excel file:
760763
761-
>>> with ExcelWriter("path_to_file.xlsx", mode="a", engine="openpyxl") as writer:
764+
>>> with pd.ExcelWriter("path_to_file.xlsx", mode="a", engine="openpyxl") as writer:
762765
... df.to_excel(writer, sheet_name="Sheet3")
763766
764767
You can store Excel file in RAM:

0 commit comments

Comments
 (0)