Skip to content

Commit ab7620d

Browse files
committed
DOC: Updated docs for arcname in NDFrame.to_csv (#26023)
1 parent 4e73dc4 commit ab7620d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

doc/source/whatsnew/v0.25.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Other Enhancements
3636
- :class:`RangeIndex` has gained :attr:`~RangeIndex.start`, :attr:`~RangeIndex.stop`, and :attr:`~RangeIndex.step` attributes (:issue:`25710`)
3737
- :class:`datetime.timezone` objects are now supported as arguments to timezone methods and constructors (:issue:`25065`)
3838
- :meth:`DataFrame.query` and :meth:`DataFrame.eval` now supports quoting column names with backticks to refer to names with spaces (:issue:`6508`)
39+
- :meth:`NDFrame.to_csv` now supports the ``arcname`` argument to specify the written CSV file name when inside a ZIP archive. Default ``arcname=None`` maintains previous behavior where the CSV name matches given ZIP path ``path_or_buf`` (:issue:`26023`)
3940

4041
.. _whatsnew_0250.api_breaking:
4142

pandas/core/generic.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3012,8 +3012,11 @@ def to_csv(self, path_or_buf=None, sep=",", na_rep='', float_format=None,
30123012
Character recognized as decimal separator. E.g. use ',' for
30133013
European data.
30143014
arcname : str, default None
3015-
Name of file within a ZIP archive. Only used when `path_or_buf` is
3016-
a path and `compression` is set to or inferred as 'zip'.
3015+
Name of CSV-formatted file within a ZIP archive. Only used when
3016+
`path_or_buf` is a path and `compression` is set to or inferred
3017+
as 'zip'. Uses `path_or_buf` if None.
3018+
3019+
.. versionadded:: 0.25.0
30173020
30183021
Returns
30193022
-------

0 commit comments

Comments
 (0)