-
Notifications
You must be signed in to change notification settings - Fork 915
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GroupBy.get_group and GroupBy.indices (#15143)
These are supposed to index based on row indices, not row labels. - Closes #14955 Authors: - Lawrence Mitchell (https://github.com/wence-) - Richard (Rick) Zamora (https://github.com/rjzamora) - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - Bradley Dice (https://github.com/bdice) URL: #15143
- Loading branch information
Showing
2 changed files
with
30 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) 2024, NVIDIA CORPORATION. | ||
from numpy.testing import assert_array_equal | ||
|
||
import cudf | ||
from cudf.testing._utils import assert_eq | ||
|
||
|
||
def test_groupby_14955(): | ||
# https://github.com/rapidsai/cudf/issues/14955 | ||
df = cudf.DataFrame({"a": [1, 2] * 2}, index=[0] * 4) | ||
agg = df.groupby("a") | ||
pagg = df.to_pandas().groupby("a") | ||
for key in agg.groups: | ||
assert_array_equal(pagg.indices[key], agg.indices[key].get()) | ||
assert_eq(pagg.get_group(key), agg.get_group(key)) |