@@ -824,49 +824,38 @@ class ExcelWriter(object):
824
824
825
825
Notes
826
826
-----
827
- None of methods and properties are considered public.
827
+ None of the methods and properties are considered public.
828
828
829
829
For compatibility with CSV writers, ExcelWriter serializes lists
830
830
and dicts to strings before writing.
831
831
832
832
Examples
833
833
--------
834
- Using ExcelWriter, some settings can be added.
835
-
836
- Default usage.
834
+ Default usage:
837
835
838
836
>>> with ExcelWriter('path_to_file.xlsx') as writer:
839
837
... df.to_excel(writer)
840
838
841
- If you want to set engine that can manipulate Excel,
842
- pass keyword argument named engine. Actually
843
- engine is automatically chosen by file extension.
844
-
845
- >>> with ExcelWriter('path_to_file.xlsx', engine='openpyxl') as writer:
846
- ... df.to_excel(writer)
847
-
848
- In order to write separate DataFrames to separate sheets
849
- in a single Excel file, one can pass an ExcelWriter.
839
+ To write to separate sheets in a single file:
850
840
851
841
>>> with ExcelWriter('path_to_file.xlsx') as writer:
852
842
... df1.to_excel(writer, sheet_name='Sheet1')
853
843
... df2.to_excel(writer, sheet_name='Sheet2')
854
844
855
- You can set date format or datetime format
845
+ You can set date format or datetime format:
856
846
857
847
>>> with ExcelWriter('path_to_file.xlsx',
858
848
date_format='YYYY-MM-DD',
859
849
datetime_format='YYYY-MM-DD HH:MM:SS') as writer:
860
850
... df.to_excel(writer)
861
851
862
- It also supports append mode.
852
+ You can also append to an existing Excel file:
863
853
864
854
>>> with ExcelWriter('path_to_file.xlsx', mode='a') as writer:
865
855
... df.to_excel(writer)
866
856
867
857
.. versionadded:: 0.24.0
868
858
869
-
870
859
Attributes
871
860
----------
872
861
None
0 commit comments