File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,29 @@ representation of :class:`DataFrame` objects (:issue:`4889`).
196
196
197
197
.. _whatsnew_140.enhancements.other :
198
198
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
+
199
222
Other enhancements
200
223
^^^^^^^^^^^^^^^^^^
201
224
- :meth: `concat ` will preserve the ``attrs `` when it is the same for all objects and discard the ``attrs `` when they are different. (:issue: `41828 `)
You can’t perform that action at this time.
0 commit comments