Skip to content
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

to_pickle doesn't support file handles #29790

Closed
jluttine opened this issue Nov 22, 2019 · 2 comments
Closed

to_pickle doesn't support file handles #29790

jluttine opened this issue Nov 22, 2019 · 2 comments
Labels
Duplicate Report Duplicate issue or pull request IO Data IO issues that don't fit into a more specific label

Comments

@jluttine
Copy link

to_pickle supports only file names, not file handles. See: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_pickle.html

Is there some particular reason for this? to_csv does support file handles so I would have expected to_pickle to support too.

To reproduce:

>>> with open("tmp.p", 'w') as fp:
...     pd.Series([1,2,3]).to_pickle(fp)

ValueError: Unrecognized compression type: infer
@jluttine
Copy link
Author

The reason I'd like to have support for file handles is that then I can explicitly flush.

@jreback
Copy link
Contributor

jreback commented Nov 22, 2019

duplicate of #26237

nothing stopping this, submit a PR today!

@jreback jreback closed this as completed Nov 22, 2019
@jreback jreback added IO Data IO issues that don't fit into a more specific label Duplicate Report Duplicate issue or pull request labels Nov 22, 2019
@jreback jreback added this to the No action milestone Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request IO Data IO issues that don't fit into a more specific label
Projects
None yet
Development

No branches or pull requests

2 participants