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
For what it's worth, I've been rewriting the IntervalIndex indexing methods as part of #16316 and this issue is not present in my new implementation:
In [2]: intv1=pd.IntervalIndex.from_arrays([1, 3, 5], [2, 4, 6])
In [3]: intv1.get_loc(intv1[0])
Out[3]: 0In [4]: intv2=pd.IntervalIndex.from_arrays([4, 2, 1], [5, 3, 2])
In [5]: intv2.get_loc(intv2[0])
Out[5]: 0
Overall that branch is still a WIP and going somewhat slowly but I should have it ready in time for 0.25.0. Would still take a fix in the meantime but be aware that it might get overwritten shortly thereafter.
Uh oh!
There was an error while loading. Please reload this page.
Code Sample, a copy-pastable example if possible
Problem description
This
IntervalIndex
is non-overlapping_monotonic.IntervalIndex.get_loc
runs inKeyError
, even the key is its first element.After
start, stop = self._find_non_overlapping_monotonic_bounds(key)
,start
andstop
get the same value. Thereafter, no conditional handles this case.Expected Outcome
In [5]: intv2 = pd.IntervalIndex.from_arrays([4, 2, 1], [5, 3, 2])
In [6]: intv2
Out[6]:
IntervalIndex([(4, 5], (2, 3], (1, 2]],
closed='right',
dtype='interval[int64]')
In [7]: intv2.get_loc(intv2[0])
Out[7]: 0
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: 0198873
python: 3.7.1.final.0
python-bits: 64
OS: Linux
OS-release: 4.18.0-16-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_HK.UTF-8
LOCALE: en_HK.UTF-8
pandas: 0.25.0.dev0+308.g01988735f
pytest: 4.0.2
pip: 18.1
setuptools: 40.6.3
Cython: 0.29.2
numpy: 1.15.4
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 7.2.0
sphinx: 1.8.2
patsy: 0.5.1
dateutil: 2.7.5
pytz: 2018.7
blosc: None
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.8
feather: None
matplotlib: 3.0.2
openpyxl: 2.5.12
xlrd: 1.2.0
xlwt: 1.3.0
xlsxwriter: 1.1.2
lxml.etree: 4.2.5
bs4: 4.6.3
html5lib: 1.0.1
sqlalchemy: 1.2.15
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None
The text was updated successfully, but these errors were encountered: