Skip to content

BUG: Empty result in df.groupby.agg on multiple keys has no columns #39809

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
rhshadrach opened this issue Feb 14, 2021 · 1 comment
Closed
Labels
API - Consistency Internal Consistency of API/Behavior Apply Apply, Aggregate, Transform, Map Bug Groupby

Comments

@rhshadrach
Copy link
Member

Comparing:

df = DataFrame(columns=["A", "B", "C"])
print(df.groupby(["A"]).sum())
print(df.groupby(["A", "B"]).sum())

gives:

Empty DataFrame
Columns: [B, C]
Index: []
Empty DataFrame
Columns: []
Index: []

This is due to taking two different paths through agg - when nkeys > 1, using _python_agg_general and otherwise using GroupByApply.agg.

@rhshadrach rhshadrach added Bug Groupby Apply Apply, Aggregate, Transform, Map API - Consistency Internal Consistency of API/Behavior labels Feb 14, 2021
@rhshadrach rhshadrach assigned rhshadrach and unassigned rhshadrach Feb 14, 2021
@rhshadrach
Copy link
Member Author

Ah - this is a duplicate of #26411

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Apply Apply, Aggregate, Transform, Map Bug Groupby
Projects
None yet
Development

No branches or pull requests

1 participant