Skip to content

BUG/ENH: to_pickle/read_pickle support compression for file ojects #35736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 5, 2020
Merged

BUG/ENH: to_pickle/read_pickle support compression for file ojects #35736

merged 1 commit into from
Sep 5, 2020

Conversation

twoertwein
Copy link
Member

@twoertwein twoertwein commented Aug 15, 2020

This was basically already supported but to/read_pickle set compression to None for file objects.

Some functions called get_filepath_or_buffer (might convert a string to a file object) before calling infer_compression (doesn't work with file objects). I moved infer_compression and get_compression_method inside get_filepath_or_buffer.

@twoertwein twoertwein changed the title TST/BUG: to_pickle/read_pickle support compression for file ojects BUG/ENH: to_pickle/read_pickle support compression for file ojects Aug 15, 2020
@twoertwein twoertwein marked this pull request as draft August 15, 2020 17:17
@twoertwein twoertwein marked this pull request as ready for review September 3, 2020 18:20
@jreback jreback added IO Data IO issues that don't fit into a more specific label IO Pickle read_pickle, to_pickle labels Sep 5, 2020
@jreback jreback added this to the 1.2 milestone Sep 5, 2020
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. doc comment, ping on green.

@@ -294,6 +294,7 @@ I/O
- :meth:`to_csv` passes compression arguments for `'gzip'` always to `gzip.GzipFile` (:issue:`28103`)
- :meth:`to_csv` did not support zip compression for binary file object not having a filename (:issue: `35058`)
- :meth:`to_csv` and :meth:`read_csv` did not honor `compression` and `encoding` for path-like objects that are internally converted to file-like objects (:issue:`35677`, :issue:`26124`, and :issue:`32392`)
- :meth:`to_picke` and :meth:`read_pickle` did not support compression for file-objects (:issue:`26237`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add all of the issue numbers here that are being closed

@twoertwein
Copy link
Member Author

@jreback ping

@jreback jreback merged commit 45cec12 into pandas-dev:master Sep 5, 2020
@jreback
Copy link
Contributor

jreback commented Sep 5, 2020

very nice @twoertwein keep em coming!

@twoertwein twoertwein deleted the pickle branch September 5, 2020 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO Data IO issues that don't fit into a more specific label IO Pickle read_pickle, to_pickle
Projects
None yet
2 participants