Turn pandas dataframe into a file-like object in memory?
https://stackoverflow.com/questions/3820406404.07.2016 · I think the issue stems from pandas setting the pos of the buffer to the end. See as follows: from StringIO import StringIO df = pd.DataFrame({"name":['foo','bar'],"id":[1,2]}) s_buf = StringIO() df.to_csv(s_buf) s_buf.__dict__ # Output # {'softspace': 0, 'buflist': ['foo,1\n', 'bar,2\n'], 'pos': 12, 'len': 12, 'closed': False, 'buf': ''}