MultiIndex.get_loc
throws KeyError
under specific circumstances
#30053
Labels
Indexing
Related to indexing on series/frames, not to indexes themselves
MultiIndex
Needs Tests
Unit test(s) needed to prevent regressions
Milestone
Code Sample, a copy-pastable example if possible
Problem description
Executing the above code results in
Note that the exception disappears if you do any of the following:
sortorder
toNone
[0, 1]
[0, 7]
Expected Output
I don't think there should be any exception here since the way I created the index appears to be valid, and the
key
is definitely in there.Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.1.final.0
python-bits : 64
OS : Linux
OS-release : 5.3.0-23-generic
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : en_US.UTF-8
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 0.25.3
numpy : 1.15.4
pytz : 2018.9
dateutil : 2.7.5
pip : 18.1
setuptools : 40.6.3
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10
IPython : 7.2.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.0.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
The text was updated successfully, but these errors were encountered: