Skip to content

raise ValueError in DataFrame.groupby.apply when index is duplicated #11810

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
quantchen opened this issue Dec 10, 2015 · 4 comments
Closed

raise ValueError in DataFrame.groupby.apply when index is duplicated #11810

quantchen opened this issue Dec 10, 2015 · 4 comments
Labels
Bug Duplicate Report Duplicate issue or pull request Groupby

Comments

@quantchen
Copy link

Exception is raised when the index is duplicated

Fro example:

df = pd.DataFrame([['a',1],['b',1],['a',2],['b',2]],columns=['c1','c2'], index=list('ccdd'))

df.groupby('c1').apply(lambda x:x)

raise ValueError("cannot reindex from a duplicate axis")
ValueError: cannot reindex from a duplicate axis

This is a new issue affecting 0.17

@quantchen quantchen changed the title rasie ValueError in DataFrame.groupby.apply when index is duplicated raise ValueError in DataFrame.groupby.apply when index is duplicated Dec 10, 2015
@jreback
Copy link
Contributor

jreback commented Dec 10, 2015

this is untested path; this repros < 0.17.0 as well.

@jreback jreback added this to the Next Major Release milestone Dec 10, 2015
@rhshadrach
Copy link
Member

This is fixed on master, just needs tests.

@rhshadrach rhshadrach added Needs Tests Unit test(s) needed to prevent regressions good first issue labels Sep 26, 2020
@DriesSchaumont
Copy link
Member

@rhshadrach, I think this is fixed in #30679 with duplicate issue #30667

@rhshadrach rhshadrach added Duplicate Report Duplicate issue or pull request and removed Needs Tests Unit test(s) needed to prevent regressions good first issue labels Mar 27, 2021
@rhshadrach
Copy link
Member

Great find - thanks @DriesSchaumont!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Duplicate Report Duplicate issue or pull request Groupby
Projects
None yet
Development

No branches or pull requests

6 participants