Skip to content

Commit 04b59a5

Browse files
committed
Fix Travis Ci build failed
* Also Update some examples of to_excel method
1 parent b2f1880 commit 04b59a5

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

pandas/core/generic.py

+7-15
Original file line numberDiff line numberDiff line change
@@ -1917,31 +1917,23 @@ def _repr_latex_(self):
19171917
... columns=['col 1', 'col 2'])
19181918
>>> df1.to_excel("output.xlsx")
19191919
1920+
If you want to set engine that can manipulate Excel,
1921+
pass keyword argument named engine. Actually
1922+
engine is automatically chosen by file extension:
1923+
1924+
>>> df1.to_excel('output1.xlsx', engine='xlsxwriter')
1925+
19201926
To specify the sheet name:
19211927
19221928
>>> df1.to_excel("output.xlsx", sheet_name='Sheet_name_1')
19231929
19241930
If you wish to write to more than one sheet in the workbook, it is
19251931
necessary to specify an ExcelWriter object:
19261932
1927-
>>> with ExcelWriter('output.xlsx') as writer:
1933+
>>> with pd.ExcelWriter('output.xlsx') as writer:
19281934
... df1.to_excel(writer, sheet_name='Sheet_name_1')
19291935
... df2.to_excel(writer, sheet_name='Sheet_name_2')
19301936
1931-
If you want to set engine that can manipulate Excel,
1932-
pass keyword argument named engine. Actually
1933-
engine is automatically chosen by file extension:
1934-
1935-
>>> df1.to_excel('output1.xlsx', engine='xlsxwriter')
1936-
>>> with ExcelWriter('output2.xlsx', engine='openpyxl') as writer:
1937-
... df2.to_excel(writer)
1938-
1939-
You can set date format or datetime format:
1940-
1941-
>>> with ExcelWriter('path_to_file.xlsx',
1942-
date_format='YYYY-MM-DD',
1943-
datetime_format='YYYY-MM-DD HH:MM:SS') as writer:
1944-
... df.to_excel(writer)
19451937
19461938
"""
19471939

0 commit comments

Comments
 (0)