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

Certain DataFrame cannot be pickled to string #511

Closed
craustin opened this issue Dec 20, 2011 · 9 comments
Closed

Certain DataFrame cannot be pickled to string #511

craustin opened this issue Dec 20, 2011 · 9 comments
Labels
Milestone

Comments

@craustin
Copy link

import cPickle
import numpy as np
from pandas import Series
s = Series({'a' : None})
s['a'] = np.inf
cPickle.loads(cPickle.dumps(s))

ValueError: could not convert string to float

@craustin
Copy link
Author

This is likely fixed by the float -> float64 fix (#510). I'll verify.

@craustin
Copy link
Author

Confirmed.

@craustin craustin reopened this Dec 21, 2011
@craustin
Copy link
Author

Chris is getting this error elsewhere. Do you think there's anything we can do? This repros in Pandas 0.4.0 as well.

@wesm
Copy link
Member

wesm commented Jan 3, 2012

Please let me know when you verify the fix-- should be taken care of by the float/float64 fix perhaps?

@craustin
Copy link
Author

craustin commented Jan 9, 2012

I thought it might be fixed by that float fix, but no luck. I still get this error on a build from 2012-01-05.

@wesm
Copy link
Member

wesm commented Jan 9, 2012

Any chance of reproducing? And this is on win32? Or rather the above code snippet fails on windows?

@craustin
Copy link
Author

craustin commented Jan 9, 2012

I can repro this with the original code in the issue. This is on EPD 6.3-2 + Windows 64.

@wesm
Copy link
Member

wesm commented Jan 9, 2012

OK, I am able to reproduce on win64 + epd 6.3-2

@wesm
Copy link
Member

wesm commented Jan 9, 2012

This is caused by a bug in NumPy 1.4.0. I verified that it's fixed in NumPy 1.6.1:

import numpy as np
import cPickle
arr = np.array([np.inf], dtype='O')
cPickle.loads(cPickle.dumps(arr))

However! Pickling with protocol 1 or 2 (or cPickle.HIGHEST_PROTOCOL) works

cPickle.loads(cPickle.dumps(arr, protocol=cPickle.HIGHEST_PROTOCOL))

You should be doing that anyway-- performance is a lot better. Make sure any file handles are open in binary mode.

@wesm wesm closed this as completed Jan 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants