Skip to content

Bug related to multilevel index series ? #2706

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
halleygithub opened this issue Jan 19, 2013 · 4 comments
Closed

Bug related to multilevel index series ? #2706

halleygithub opened this issue Jan 19, 2013 · 4 comments
Assignees
Labels
Milestone

Comments

@halleygithub
Copy link

I am upgrading Pandas from 0.8.1 to 0.10.1.dev-f7f7e13 . My environment is Window XP with below: Python: 2.7.3 Numpy: 1.6.2 MPL: 1.1.1 Pandas: 0.10.1.dev-f7f7e13.

Then OK application on 0.8.1 now meets errors. I trace the root cause to filtering the duplicated index of Series. Detail in : http://stackoverflow.com/questions/14395678/how-to-drop-extra-copy-of-duplicate-index-of-pandas-series

simply put: below snippet has two issues :

import pandas as pd
idx_tp = [('600809', '20061231'), ('600809', '20070331'), ('600809', '20070630'), ('600809', '20070331')]
dt = ['demo','demo','demo','demo']
idx = pd.MultiIndex.from_tuples(idx_tp,names = ['STK_ID','RPT_Date'])
s = pd.Series(dt,index=idx)

Issue 1: s[s.index.unique()] works well on 0.8.1 but not 0.10.1

Issue 2: s.groupby(s.index).first() will crash on my machine

@wesm
Copy link
Member

wesm commented Jan 19, 2013

thanks will have a look

@wesm
Copy link
Member

wesm commented Jan 20, 2013

Fixed the second issue. I'm surprised the first ever worked, going to have a look at 0.8.1

@wesm
Copy link
Member

wesm commented Jan 20, 2013

The first is not a supported API and only worked by accident before. Please do something like:

In [16]: s[-Series(s.index.values, s.index).duplicated()]
Out[16]: 
STK_ID  RPT_Date
600809  20061231    demo
        20070331    demo
        20070630    demo

I need to add a top level function duplicated.

@halleygithub
Copy link
Author

Thanks. but "s[s.index.unique()]" looks elegant than "s[-Series(s.index.values, s.index).duplicated()]" .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants