Skip to content

BUG: Groupby.transform('cumcount') fails #27472

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
ghost opened this issue Jul 19, 2019 · 6 comments · Fixed by #42656
Closed

BUG: Groupby.transform('cumcount') fails #27472

ghost opened this issue Jul 19, 2019 · 6 comments · Fixed by #42656
Assignees
Labels
good first issue Groupby Needs Tests Unit test(s) needed to prevent regressions

Comments

@ghost
Copy link

ghost commented Jul 19, 2019

Adding tests for #27467 surfaced some bugs:

from pandas import *
df = DataFrame(dict(a=[0, 0, 0, 1, 1, 1], b=range(6)))
g = df.groupby(np.repeat([0,1], 3))
# ok
g.cumcount()
# fails
g.transform('cumcount')
AttributeError: ("'Series' object has no attribute 'cumcount'", 'occurred at index a')

cumcount is a cythonized function.

@jreback
Copy link
Contributor

jreback commented Jul 19, 2019

rather than make an issue for each one of .transform()
just create a checkbox list in one issue

@ghost
Copy link
Author

ghost commented Jul 19, 2019

Ok, but not all of these are the same bug though.

@jreback
Copy link
Contributor

jreback commented Jul 19, 2019

that’s fine you can edit the top and mark them off individually
they are just must easier to find / grok

@TomAugspurger
Copy link
Contributor

Stalled PR at #27858, if anyone wants to update.

Removing from the 1.0 milestone, but if a PR comes in we would certainly take it for 1.0.

@mroeschke
Copy link
Member

I think this works on master now. Could use a test

In [3]: from pandas import *
   ...: df = DataFrame(dict(a=[0, 0, 0, 1, 1, 1], b=range(6)))
   ...: g = df.groupby(np.repeat([0,1], 3))
   ...: # ok
   ...: g.cumcount()
   ...: # fails
   ...: g.transform('cumcount')
Out[3]:
0    0
1    1
2    2
3    0
4    1
5    2
dtype: int64

@mroeschke mroeschke added good first issue Needs Tests Unit test(s) needed to prevent regressions and removed Bug labels Jul 10, 2021
@saehuihwang
Copy link
Contributor

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Groupby Needs Tests Unit test(s) needed to prevent regressions
Projects
None yet
5 participants