Etched DataFrame

I am trying to sort a DataFrame using

import pandas as pd from pandas import DataFrame data = pd.read_table('Purchases.tsv',index_col='coreuserid') data.to_pickle('Purchases.pkl') 

I worked on the β€œdata” for some time, and I had no problems, so I know that this is not a problem with data corruption. I think the syntax is probably, but I tried several options. I'm embarrassed to give an error message, but it ends with:

 \pickle.pyc in to_pickle(obj, path) 13 """ 14 with open(path, 'wb') as f: 15 pkl.dump(obj, f, protocol=pkl.HIGHEST_PROTOCOL) SystemError: error return without exception set 

The Purchases.pkl file is created, but if I call

 data = pd.read_pickle('Purchases.pkl') 

I get an EOFError. I use Canopy 1.4, so pandas 0.13.1, which must be recent enough to have this functionality.

+8
python pandas pickle canopy
source share
2 answers

Move forward a few years and now it works great. Thanks pandas;)

+1
source share

You can try to create a class from your DataFrame and sort it after.

This may help you: Skip pandas dataframe to class

0
source share

All Articles