Skip to content

PREF: Fix regression from #58984 #59025

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

Merged
merged 3 commits into from
Jun 17, 2024
Merged
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
9 changes: 5 additions & 4 deletions pandas/_libs/groupby.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,12 @@ def group_cumsum(
for i in range(N):
lab = labels[i]

if lab < 0:
if uses_mask and lab < 0:
Copy link
Contributor Author

@luke396 luke396 Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the solution for the bug fix mentioned in #58984 is the only one available, I believe some regression may be unavoidable.

On my local machine, this change seems to yield some performance gains, but perhaps they are merely an illusion.

# GH#58811
if uses_mask:
result_mask[i, :] = True
out[i, :] = 0
result_mask[i, :] = True
out[i, :] = 0
continue
elif lab < 0:
continue

for j in range(K):
Expand Down
Loading