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
jorisvandenbossche
changed the title
BUG: Overflow encountered when using .loc with Uint64Index
BUG: Overflow encountered when using .loc with UInt64Index
Apr 17, 2018
Thanks for the report!
In contrast to loc, getitem works:
In [29]: s[18446744073709551614]
Out[29]: 1
One of the errors is happening in contains:
In [30]: s.index.contains(18446744073709551614)
---------------------------------------------------------------------------
OverflowError Traceback (most recent call last)
<ipython-input-30-cec353dff8b1> in <module>()
----> 1 s.index.contains(18446744073709551614)
/home/joris/scipy/pandas/pandas/core/indexes/base.py in contains(self, key)
2008 hash(key)
2009 try:
-> 2010 return key in self._engine
2011 except (TypeError, ValueError):
2012 return False
/home/joris/scipy/pandas/pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.__contains__()
/home/joris/scipy/pandas/pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.UInt64HashTable.__contains__()
OverflowError: Python int too large to convert to C long
Code Sample, a copy-pastable example if possible
Problem description
loc
leads to an overflow even with consistent dtype (uint64
for the index of the Series and the value pass toloc
).Expected Output
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: