From 73872fe85f3280c048d4c76eaf0074e7defacffc Mon Sep 17 00:00:00 2001 From: Zhengbo Wang Date: Mon, 17 Jun 2024 13:57:56 +0800 Subject: [PATCH 1/3] check uses_mask before --- pandas/_libs/groupby.pyx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandas/_libs/groupby.pyx b/pandas/_libs/groupby.pyx index 7937b2ab72c37..ff2ea355ea01c 100644 --- a/pandas/_libs/groupby.pyx +++ b/pandas/_libs/groupby.pyx @@ -398,11 +398,11 @@ def group_cumsum( for i in range(N): lab = labels[i] - if lab < 0: - # GH#58811 - if uses_mask: - result_mask[i, :] = True - out[i, :] = 0 + if uses_mask and lab < 0: + result_mask[i, :] = True + out[i, :] = 0 + continue + elif lab < 0: continue for j in range(K): From fc80ffc4484f66fa8effe4f980831a2d497d6004 Mon Sep 17 00:00:00 2001 From: Zhengbo Wang Date: Mon, 17 Jun 2024 14:57:13 +0800 Subject: [PATCH 2/3] backup gh --- pandas/_libs/groupby.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/_libs/groupby.pyx b/pandas/_libs/groupby.pyx index ff2ea355ea01c..130ec4f8e7e82 100644 --- a/pandas/_libs/groupby.pyx +++ b/pandas/_libs/groupby.pyx @@ -399,6 +399,7 @@ def group_cumsum( lab = labels[i] if uses_mask and lab < 0: + # # GH#58811 result_mask[i, :] = True out[i, :] = 0 continue From e5a23fb1b0b03781f6c054054795149195fd6856 Mon Sep 17 00:00:00 2001 From: Zhengbo Wang Date: Mon, 17 Jun 2024 14:57:24 +0800 Subject: [PATCH 3/3] backup gh --- pandas/_libs/groupby.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/groupby.pyx b/pandas/_libs/groupby.pyx index 130ec4f8e7e82..d7e485f74e58b 100644 --- a/pandas/_libs/groupby.pyx +++ b/pandas/_libs/groupby.pyx @@ -399,7 +399,7 @@ def group_cumsum( lab = labels[i] if uses_mask and lab < 0: - # # GH#58811 + # GH#58811 result_mask[i, :] = True out[i, :] = 0 continue