You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The maximum value for np.uint64 is (2^64)-1 so why does pandas convert np.uint64 types greater than 2^63-1 to objects when converting arrays to dataframes. pd.to_numeric() also fails to convert these values back to np.uint64.
The text was updated successfully, but these errors were encountered:
ily9000
changed the title
pandas convert np.uint64 greater than 2**63-1 to objects
pandas converts np.uint64 greater than 2**63-1 to objects
Dec 15, 2015
ily9000
changed the title
pandas converts np.uint64 greater than 2**63-1 to objects
pd.DataFrame converts np.uint64 greater than 2**63-1 to objects
Dec 15, 2015
@jreback FYI: I've just hit this issue while working on a real life, commercial project. My largish (few GB) datasets consist of uint64 elements, runs failed on some of them, and I tracked down the issue to this. Trying to find a workaround...
@jreback Re: you can't think of a use case — unfortunately I'm importing a dataset which already has uint64's in it. Not being able to use them is quite a big inconvenience, as I keep hitting this, even if I work around it!
I think this is really surprising behaviour, but I guess that's because DataFrame's storage is somehow different from that of a Series in a way I don't understand...
In [1]: importpandasaspd, numpyasnpIn [2]: s=pd.Series(np.array([2**64-1]))
In [3]: s.dtypeOut[3]: dtype('uint64')
In [4]: df=pd.DataFrame({"s": s})
In [5]: df.dtypesOut[5]:
sobjectdtype: object
My question is based on this post I found:
http://stackoverflow.com/questions/34283319/pandas-converts-large-unsigned-integers-to-object-types
The maximum value for np.uint64 is (2^64)-1 so why does pandas convert np.uint64 types greater than 2^63-1 to objects when converting arrays to dataframes. pd.to_numeric() also fails to convert these values back to np.uint64.
The text was updated successfully, but these errors were encountered: