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: groupby with reducer of max and as_index=False raises #7115

Closed
jreback opened this issue May 13, 2014 · 0 comments · Fixed by #8585
Closed

BUG: groupby with reducer of max and as_index=False raises #7115

jreback opened this issue May 13, 2014 · 0 comments · Fixed by #8585
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented May 13, 2014

This shouldn't raise

from here originally (not the bug, the data/question):
http://stackoverflow.com/questions/23635647/how-to-force-pandas-dataframe-apply-on-a-grouped-dataframe

In [30]: df = pd.DataFrame({'a':range(5), 'b': range(5, 10)})

In [31]: df
Out[31]: 
   a  b
0  0  5
1  1  6
2  2  7
3  3  8
4  4  9

[5 rows x 2 columns]

In [32]: df.groupby(df.a<2).max()
Out[32]: 
       a  b
a          
False  4  9
True   1  6

[2 rows x 2 columns]

In [33]: df.groupby(df.a<2,as_index=False).max()
ValueError: cannot insert a, already exists
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.

1 participant