Skip to content

BUG: MultiIndex dtypes incorrect if level names not unique #45174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
johnzangwill opened this issue Jan 3, 2022 · 1 comment · Fixed by #45175
Closed
3 tasks done

BUG: MultiIndex dtypes incorrect if level names not unique #45174

johnzangwill opened this issue Jan 3, 2022 · 1 comment · Fixed by #45175
Assignees
Milestone

Comments

@johnzangwill
Copy link
Contributor

Pandas version checks

  • 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

import pandas as pd
index = pd.MultiIndex.from_arrays([[1], [2]], names=[1, 1])
index.dtypes
1    int64
dtype: object

Issue Description

If there are duplicate multiIndex levels then dtypes only returns one entry for all the matching levels rather than one for each level

Expected Behavior

import pandas as pd
index = pd.MultiIndex.from_arrays([[1], [2]], names=[1, 1])
index.dtypes
1    int64
1    int64
dtype: object

Installed Versions

INSTALLED VERSIONS

commit : 9093374
python : 3.8.12.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19043
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 9, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United Kingdom.1252

pandas : 1.4.0.dev0+1555.g90933743f2
numpy : 1.21.5
pytz : 2021.3
dateutil : 2.8.2
pip : 21.3.1
setuptools : 60.0.5
Cython : 0.29.26
pytest : 6.2.5
hypothesis : 6.32.1
sphinx : 4.3.2
blosc : None
feather : None
xlsxwriter : 3.0.2
lxml.etree : 4.7.1
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 3.0.3
IPython : 7.30.1
pandas_datareader: None
bs4 : 4.10.0
bottleneck : 1.3.2
fsspec : 2021.11.0
fastparquet : 0.7.2
gcsfs : 2021.11.0
matplotlib : 3.5.1
numexpr : 2.8.0
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : 6.0.1
pyxlsb : None
s3fs : 2021.11.0
scipy : 1.7.3
sqlalchemy : 1.4.29
tables : 3.6.1
tabulate : 0.8.9
xarray : 0.18.2
xlrd : 2.0.1
xlwt : 1.3.0
numba : 0.53.1
zstandard : None

@johnzangwill johnzangwill added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 3, 2022
@johnzangwill
Copy link
Contributor Author

take

@jreback jreback added this to the 1.4 milestone Jan 3, 2022
@jreback jreback added MultiIndex and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants