Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shwina committed Feb 8, 2024
1 parent 2088742 commit b2cc741
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion python/cudf/cudf/_lib/groupby.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ cdef class GroupBy:
return (
offsets,
columns_from_pylibcudf_table(grouped_keys),
columns_from_pylibcudf_table(grouped_values),
(
columns_from_pylibcudf_table(grouped_values)
if grouped_values is not None else []
),
)

def aggregate(self, values, aggregations):
Expand Down
4 changes: 2 additions & 2 deletions python/cudf/cudf/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ def _head_tail(self, n, *, take_head: bool, preserve_order: bool):
# Can't use _mimic_pandas_order because we need to
# subsample the gather map from the full input ordering,
# rather than permuting the gather map of the output.
_, (ordering,), _ = self._groupby.groups(
_, _, (ordering,) = self._groupby.groups(
[as_column(range(0, len(self.obj)))]
)
# Invert permutation from original order to groups on the
Expand Down Expand Up @@ -2583,7 +2583,7 @@ def _mimic_pandas_order(
# result coming back from libcudf has null_count few rows than
# the input, so we must produce an ordering from the full
# input range.
_, (ordering,), _ = self._groupby.groups(
_, _, (ordering,) = self._groupby.groups(
[as_column(range(0, len(self.obj)))]
)
if self._dropna and any(
Expand Down
2 changes: 1 addition & 1 deletion python/cudf/cudf/tests/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -3763,4 +3763,4 @@ def test_groupby_internal_groups_empty(gdf):
# .groups() method with an empty list:
gb = gdf.groupby("y")._groupby
_, _, grouped_vals = gb.groups([])
assert grouped_vals is None
assert grouped_vals == []

0 comments on commit b2cc741

Please sign in to comment.