From c7e81f5472a7fc490c86e5bfa3084a1915e63dee Mon Sep 17 00:00:00 2001 From: Omer Danziger <57575138+Omerdan03@users.noreply.github.com> Date: Mon, 12 Jul 2021 09:15:14 +0300 Subject: [PATCH 1/2] Update series.py fix bug where inplace return the series. https://github.com/pandas-dev/pandas/issues/42481 --- pandas/core/series.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index 87d419d1f3d41..2aa9bb8bc2188 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -1760,7 +1760,7 @@ def _set_name(self, name, inplace=False) -> Series: inplace = validate_bool_kwarg(inplace, "inplace") ser = self if inplace else self.copy() ser.name = name - return ser + return ser if not inplace else None @Appender( """ From 6c5e503fd0d724e31b84090fa8682c3163da5f44 Mon Sep 17 00:00:00 2001 From: Omer Danziger <57575138+Omerdan03@users.noreply.github.com> Date: Mon, 12 Jul 2021 10:17:50 +0300 Subject: [PATCH 2/2] Update series.py change return order --- pandas/core/series.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index 2aa9bb8bc2188..37fb6616ef746 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -1760,7 +1760,7 @@ def _set_name(self, name, inplace=False) -> Series: inplace = validate_bool_kwarg(inplace, "inplace") ser = self if inplace else self.copy() ser.name = name - return ser if not inplace else None + return None if inplace else ser @Appender( """