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
Lookup in a UInt64Index appears to fail for values larger than 2**63-1 (but smaller than 2**64). Here's a simple example session (Pandas 0.22.0, Python 3.6.)
>>>importpandasaspd>>>s=pd.Series({0x7fff_ffff_ffff_ffff: 3, 0x8000_0000_0000_0000: 4})
>>>type(s.index)
<class'pandas.core.indexes.numeric.UInt64Index'>>>>s.loc[0x7fff_ffff_ffff_ffff]
3>>>s.loc[0x8000_0000_0000_0000]
Traceback (mostrecentcalllast):
File"/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/indexing.py", line1505, in_has_valid_typeifnotax.contains(key):
File"/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/indexes/base.py", line1716, incontainsreturnkeyinself._engineFile"pandas/_libs/index.pyx", line81, inpandas._libs.index.IndexEngine.__contains__File"pandas/_libs/hashtable_class_helper.pxi", line591, inpandas._libs.hashtable.UInt64HashTable.__contains__OverflowError: PythoninttoolargetoconverttoClongDuringhandlingoftheaboveexception, anotherexceptionoccurred:
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/indexing.py", line1373, in__getitem__returnself._getitem_axis(maybe_callable, axis=axis)
File"/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/indexing.py", line1626, in_getitem_axisself._has_valid_type(key, axis)
File"/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/indexing.py", line1514, in_has_valid_typeerror()
File"/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/indexing.py", line1501, inerroraxis=self.obj._get_axis_name(axis)))
KeyError: 'the label [9223372036854775808] is not in the [index]'
I would have expected the second lookup to succeed, returning 4.
The text was updated successfully, but these errors were encountered:
mdickinson
changed the title
UInt64Index: lookup by label gives traceback for values over 2**63-1
UInt64Index: lookup by label gives KeyError for values over 2**63-1
Jan 25, 2018
[From a StackOverflow question]
Lookup in a
UInt64Index
appears to fail for values larger than2**63-1
(but smaller than2**64
). Here's a simple example session (Pandas 0.22.0, Python 3.6.)I would have expected the second lookup to succeed, returning
4
.Output of
pd.show_versions()
pandas: 0.22.0
pytest: None
pip: 9.0.1
setuptools: 36.8.0
Cython: 0.27.3
numpy: 1.14.0
scipy: 1.0.0
pyarrow: None
xarray: None
IPython: 6.2.1
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.1.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0b10
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: