BUG: .loc[]
on Series with MultiIndex raises "ValueError: Too many indices" if one level is a tuple
#43908
Closed
2 of 3 tasks
Labels
Milestone
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the master branch of pandas.
Reproducible Example
Issue Description
A Series with a MultiIndex where one level is a tuple cannot be indexed with
.loc[]
. Instead it raisesValueError: Too many indices
:Expected Behavior
Up to v1.2.5 indexing works as expected to select the data:
~/src/pandas $ python test.py 1.2.5 1
Installed Versions
INSTALLED VERSIONS
commit : 73c6825
python : 3.8.11.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-81-generic
Version : #91~18.04.1-Ubuntu SMP Fri Jul 23 13:36:29 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_SG.UTF-8
LOCALE : en_SG.UTF-8
pandas : 1.3.3
numpy : 1.21.2
pytz : 2021.3
dateutil : 2.8.2
pip : 21.1.1
setuptools : 56.0.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: