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

Unhelpful error message when groupby() called with a column that is duplicated #7511

Closed
cpbl opened this issue Jun 19, 2014 · 3 comments
Closed
Labels
Error Reporting Incorrect or improved errors from pandas Groupby
Milestone

Comments

@cpbl
Copy link

cpbl commented Jun 19, 2014

The following code:

import pandas as pd
p1 = {'name': 'willy', 'age': 10}
p2 = {'name': 'willy', 'age': 11}
p3 = {'name': 'zoe', 'age': 10}
df = pd.DataFrame([p1, p2, p3])
df = df[['name','name','age']]
df.groupby('name')

gives the following error:

TypeError: 'DataFrame' object is not callable

Instead, it should say "Cannot groupby a column which exists more than once"

@jreback
Copy link
Contributor

jreback commented Jun 19, 2014

that does seem unhelpful!

care to do a pull-request to fix (prob just catch the TypeError in core/groupby.pythen if its a duplicate raise maybe a ValueError) ?

@jreback jreback added this to the 0.15.0 milestone Jun 19, 2014
@hayd
Copy link
Contributor

hayd commented Sep 3, 2014

@jreback
Copy link
Contributor

jreback commented Sep 10, 2014

closed by #8210

@jreback jreback closed this as completed Sep 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas Groupby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants