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] Grouping by callables doesn't match pandas #17486

Open
Matt711 opened this issue Dec 2, 2024 · 0 comments
Open

[BUG] Grouping by callables doesn't match pandas #17486

Matt711 opened this issue Dec 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Matt711
Copy link
Contributor

Matt711 commented Dec 2, 2024

Describe the bug
See the repro

Steps/Code to reproduce bug

import pandas as pd

df = pd.DataFrame(
    {
        "A": ["foo", "bar", "foo", "bar"],
        "B": ["one", "one", "two", "three"],
        "C": [1,3,6,10],
        "D": [2,4,6,8],
    }
)
col1 = df["A"]
col2 = df["B"]

grouped = df.groupby([col1.get, col2.get])
agged = grouped.mean(numeric_only=True)
print(agged.loc[:, ["C", "D"]])

with cudf.pandas

      C    D
0   1.0  2.0
1   3.0  4.0
2   6.0  6.0
3  10.0  8.0

with pandas:

              C    D
bar one     3.0  4.0
    three  10.0  8.0
foo one     1.0  2.0
    two     6.0  6.0

Expected behavior
Should match pandas

@Matt711 Matt711 added the bug Something isn't working label Dec 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
None yet
Development

No branches or pull requests

1 participant