From 885339ffe6628bf27400cc39e437fdd826631095 Mon Sep 17 00:00:00 2001 From: jmishra Date: Wed, 20 Jan 2021 20:00:02 +0530 Subject: [PATCH 1/3] To fix bug #39166 --- pandas/core/apply.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/core/apply.py b/pandas/core/apply.py index 0246971bfa2b4..2a913b331f153 100644 --- a/pandas/core/apply.py +++ b/pandas/core/apply.py @@ -530,7 +530,8 @@ def series_generator(self): ser._mgr = mgr blk.values = arr ser.name = name - yield ser + # To fix bug #39166 + yield ser.copy() @property def result_index(self) -> Index: From de10be801f90b03a3521c4eceb8a9de21e3d8b89 Mon Sep 17 00:00:00 2001 From: jmishra Date: Wed, 20 Jan 2021 21:19:34 +0530 Subject: [PATCH 2/3] revert my changes --- pandas/core/apply.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/core/apply.py b/pandas/core/apply.py index 2a913b331f153..0246971bfa2b4 100644 --- a/pandas/core/apply.py +++ b/pandas/core/apply.py @@ -530,8 +530,7 @@ def series_generator(self): ser._mgr = mgr blk.values = arr ser.name = name - # To fix bug #39166 - yield ser.copy() + yield ser @property def result_index(self) -> Index: From 3aca523cdde60ae198f2b29e62b0755b74289aad Mon Sep 17 00:00:00 2001 From: jmishra Date: Wed, 20 Jan 2021 22:51:43 +0530 Subject: [PATCH 3/3] Fix issue of apply function of DataFrame --- pandas/core/apply.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/core/apply.py b/pandas/core/apply.py index 0246971bfa2b4..3544f165e1d68 100644 --- a/pandas/core/apply.py +++ b/pandas/core/apply.py @@ -530,7 +530,8 @@ def series_generator(self): ser._mgr = mgr blk.values = arr ser.name = name - yield ser + # To fix issue of #39166 + yield ser.copy() @property def result_index(self) -> Index: