Skip to content

[Feature Request] read_pickle and to_pickle Optionally Read/Return Strings Similar to Pickle's dumps and loads #17392

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

Closed
DWDuq opened this issue Aug 31, 2017 · 1 comment
Labels
Duplicate Report Duplicate issue or pull request IO Data IO issues that don't fit into a more specific label

Comments

@DWDuq
Copy link

DWDuq commented Aug 31, 2017

Unless I'm mistaken there's no official way of directly getting a string representation of a DataFrame. I was using cPickle's dumps and loads functions for this, but upgrading from 0.19 to 0.20 broke things. Yes, I could use Pandas' read_pickle and to_pickle functions as they are now and use the hard disk as an intermediate step, but this would hurt performance and seems unnecessarily roundabout. Having read_pickle and to_pickle optionally work with a string similar to cPickle's dumps and loads functions would be quite straightforward, no?

@chris-b1
Copy link
Contributor

duplicate of #5924 - never really settled on an API, feel free to comment there.

If you want want work with strings today you can use StringIO/BytesIO

from io import BytesIO
buf = BytesIO()
df.to_pickle(buf)

buf.seek(0)

df = pd.read_pickle(buf)

@chris-b1 chris-b1 added IO Data IO issues that don't fit into a more specific label Duplicate Report Duplicate issue or pull request labels Aug 31, 2017
@chris-b1 chris-b1 added this to the No action milestone Aug 31, 2017
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