Skip to content

Commit

Permalink
fixup for int32
Browse files Browse the repository at this point in the history
  • Loading branch information
rhshadrach committed Nov 14, 2023
1 parent b79cc85 commit 6ee8fcb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pandas/core/groupby/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ def result_index_and_ids(self) -> tuple[Index, np.ndarray]:
shape = tuple(len(level) for level in ob_levels)
group_index = get_group_index(ob_codes, shape, sort=True, xnull=True)
ob_ids, obs_group_ids = compress_group_index(group_index, sort=self._sort)
ob_ids = ensure_platform_int(ob_ids)
ob_index_codes = decons_obs_group_ids(
ob_ids, obs_group_ids, shape, ob_codes, xnull=True
)
Expand Down Expand Up @@ -833,9 +834,9 @@ def result_index_and_ids(self) -> tuple[Index, np.ndarray]:
if self._sort:
sorter = result_index.argsort()
result_index = result_index.take(sorter)
_, inverse = np.unique(sorter, return_index=True)
_, index = np.unique(sorter, return_index=True)
ids = ensure_platform_int(ids)
ids = inverse.take(ids)
ids = index.take(ids)
else:
ids, uniques = compress_group_index(ids, sort=False)
ids = ensure_platform_int(ids)
Expand Down

0 comments on commit 6ee8fcb

Please sign in to comment.