Skip to content
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

BUG: MultiIndex.drop_duplicates() drops names #10115

Closed
seth-p opened this issue May 12, 2015 · 1 comment · Fixed by #10367
Closed

BUG: MultiIndex.drop_duplicates() drops names #10115

seth-p opened this issue May 12, 2015 · 1 comment · Fixed by #10367
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves MultiIndex
Milestone

Comments

@seth-p
Copy link
Contributor

seth-p commented May 12, 2015

In [12]: import pandas as pd

In [13]: mi = pd.MultiIndex.from_tuples([('A','a',1), ('A','a',2)],
                                        names=['Upper','Lower','Num'])

In [14]: mi.drop_duplicates()
Out[14]:
MultiIndex(levels=[['A'], ['a'], [1, 2]],
           labels=[[0, 0], [0, 0], [0, 1]])

In [16]: mi.names
Out[16]: FrozenList(['Upper', 'Lower', 'Num'])

In [18]: mi.drop_duplicates().names
Out[18]: FrozenList([None, None, None])
@seth-p
Copy link
Contributor Author

seth-p commented May 12, 2015

Index.drop_duplicates() similarly drops its name:

In [69]: idx = pd.Index([3, 4, 5, 3], name='foo')

In [70]: idx
Out[70]: Int64Index([3, 4, 5, 3], dtype='int64', name='foo')

In [71]: idx.drop_duplicates()
Out[71]: Int64Index([3, 4, 5], dtype='int64')

In [72]: idx.drop_duplicates().name

@jreback jreback added Bug Indexing Related to indexing on series/frames, not to indexes themselves MultiIndex labels May 13, 2015
@jreback jreback added this to the 0.17.0 milestone May 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves MultiIndex
Projects
None yet
2 participants