File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -551,7 +551,7 @@ class ExcelWriter(metaclass=abc.ABCMeta):
551551
552552 Parameters
553553 ----------
554- path : str
554+ path : str or typing.BinaryIO
555555 Path to xls or xlsx or ods file.
556556 engine : str (optional)
557557 Engine to use for writing. If None, defaults to
@@ -606,6 +606,21 @@ class ExcelWriter(metaclass=abc.ABCMeta):
606606
607607 >>> with ExcelWriter('path_to_file.xlsx', mode='a') as writer:
608608 ... df.to_excel(writer, sheet_name='Sheet3')
609+
610+ You can store Excel file in RAM:
611+
612+ >>> import io
613+ >>> buffer = io.BytesIO()
614+ >>> with pd.ExcelWriter(buffer) as writer:
615+ ... df.to_excel(writer)
616+
617+ You can pack Excel file into zip archive:
618+
619+ >>> import zipfile
620+ >>> with zipfile.ZipFile('path_to_file.zip', 'w') as zf:
621+ ... with zf.open('filename.xlsx', 'w') as buffer:
622+ ... with pd.ExcelWriter(buffer) as writer:
623+ ... df.to_excel(writer)
609624 """
610625
611626 # Defining an ExcelWriter implementation (see abstract methods for more...)
You can’t perform that action at this time.
0 commit comments