Skip to content

Commit e66826b

Browse files
authored
chore: add whatsnew entry
1 parent a4ac382 commit e66826b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

doc/source/whatsnew/v1.4.0.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,29 @@ representation of :class:`DataFrame` objects (:issue:`4889`).
196196
197197
.. _whatsnew_140.enhancements.other:
198198

199+
Reading directly from TAR archives
200+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
201+
202+
I/O methods like :function:`read_csv` or :meth:`DataFrame.to_json` now allow reading and writing
203+
directly on TAR archives (:issue:`44787`).
204+
205+
.. code-block:: python
206+
207+
df = pd.read_csv("./movement.tar.gz")
208+
# ...
209+
df.to_csv("./out.tar.gz")
210+
211+
This supports ``.tar``, ``.tar.gz``, ``.tar.bz`` and ``.tar.xz2`` archives.
212+
The used compression method is inferred from the filename.
213+
If the compression method cannot be inferred, use the ``compression`` argument:
214+
215+
.. code-block:: python
216+
217+
df = pd.read_csv(some_file_obj, compression={"method": "tar", "mode": "r:gz"}) # noqa F821
218+
219+
(``mode`` being one of ``tarfile.open``'s modes: https://docs.python.org/3/library/tarfile.html#tarfile.open)
220+
221+
199222
Other enhancements
200223
^^^^^^^^^^^^^^^^^^
201224
- :meth:`concat` will preserve the ``attrs`` when it is the same for all objects and discard the ``attrs`` when they are different. (:issue:`41828`)

0 commit comments

Comments
 (0)