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] SeriesGroupBy.aggregate is inconsistent with pandas #14957

Closed
rjzamora opened this issue Feb 2, 2024 · 0 comments · Fixed by #14971
Closed

[BUG] SeriesGroupBy.aggregate is inconsistent with pandas #14957

rjzamora opened this issue Feb 2, 2024 · 0 comments · Fixed by #14971
Labels
bug Something isn't working

Comments

@rjzamora
Copy link
Member

rjzamora commented Feb 2, 2024

Describe the bug
There seems to be a minor/subtle discrepancy between cuDF and Pandas for SeriesGroupBy.aggregate. If the argument to aggregate is a single string (or callable), the result should be a Series object. However, cuDF produces a DataFrame.

Steps/Code to reproduce bug

import cudf

df = cudf.DataFrame({"a": [1, 2] * 2, "b": [0] * 4})
pdf = df.to_pandas()
agg = df.groupby("a")["a"].aggregate("count")
pd_agg = pdf.groupby(["a"])["a"].aggregate("count")

assert agg.ndim == pd_agg.ndim  # Fails

cuDF result (a DataFrame):

   a
a   
1  2
2  2

Pandas result (a Series):

a
1    2
2    2
Name: a, dtype: int64

Additional context
This bug causes some test failures for dask_cudf + dask-expr in #14805 when the groupby tests are not skipped.

@rjzamora rjzamora added the bug Something isn't working label Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant