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

Fix Groupby.get_group #14728

Merged
merged 6 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/cudf/cudf/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def get_group(self, name, obj=None):
if obj is None:
obj = self.obj

return obj.loc[self.groups[name]]
return obj.loc[self.groups[name].drop_duplicates()]

@_cudf_nvtx_annotate
def size(self):
Expand Down
13 changes: 12 additions & 1 deletion python/cudf/cudf/tests/groupby/test_indexing.py
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# Copyright (c) 2023, NVIDIA CORPORATION.
# Copyright (c) 2023-2024, NVIDIA CORPORATION.
import cudf
from cudf.testing._utils import assert_eq


def test_rank_return_type_compatible_mode():
# in compatible mode, rank() always returns floats
df = cudf.DataFrame({"a": range(10), "b": [0] * 10}, index=[0] * 10)
pdf = df.to_pandas()
expect = pdf.groupby("b").get_group(0)
result = df.groupby("b").get_group(0)
assert_eq(expect, result)
Loading