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.agg allows non-aggregating built-in functions #58284

Closed
3 tasks done
WillAyd opened this issue Apr 17, 2024 · 2 comments
Closed
3 tasks done

BUG: GroupBy.agg allows non-aggregating built-in functions #58284

WillAyd opened this issue Apr 17, 2024 · 2 comments
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@WillAyd
Copy link
Member

WillAyd commented Apr 17, 2024

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

In [38]: df = pd.DataFrame({"group": list("aab"), "val1": range(3)})

In [39]: df.groupby("group").agg("cumsum")
Out[39]: 
   val1
0     0
1     1
2     2

In [40]: df.groupby("group").agg(lambda x: x.cumsum())
ValueError: Must produce aggregated value

Issue Description

The built-in transformation functions are allowed as arguments to .agg. Haven't checked yet that this is solved by @rhshadrach work in #57706

Expected Behavior

Error for built-in functions

Installed Versions

'3.0.0.dev0+681.g434fda08cf'

@WillAyd WillAyd added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 17, 2024
@rhshadrach
Copy link
Member

I think of this as #44845. I decided to keep it out of scope for #57706 since it could independently be done.

@WillAyd
Copy link
Member Author

WillAyd commented Apr 17, 2024

Ah thanks - sorry I didn't catch that. This is defintely a dupe

@WillAyd WillAyd closed this as completed Apr 17, 2024
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

2 participants