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?

Comment From: chris-b1

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)