Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions pandas/_libs/groupby.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1325,8 +1325,9 @@ def group_rank(
mask=sub_mask,
)
for i in range(len(result)):
# TODO: why can't we do out[:, k] = result?
out[i, k] = result[i]
if labels[i] >= 0:
# TODO: why can't we do out[:, k] = result?
out[i, k] = result[i]


# ----------------------------------------------------------------------
Expand Down
4 changes: 0 additions & 4 deletions pandas/core/groupby/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,6 @@ def _call_cython_op(

result = result.T

if self.how == "rank" and self.has_dropped_na:
# TODO: Wouldn't need this if group_rank supported mask
result = np.where(comp_ids < 0, np.nan, result)

if self.how not in self.cast_blocklist:
# e.g. if we are int64 and need to restore to datetime64/timedelta64
# "rank" is the only member of cast_blocklist we get here
Expand Down