From 19ccb4ba16ad2118b4722ef924da0f5165b5cc5c Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Fri, 12 Dec 2025 10:11:53 +0100 Subject: [PATCH 1/4] DOC: update Series() docstring about copy behaviour --- pandas/core/series.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index 1ea8bbbaa0cfb..089d000e15115 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -265,8 +265,11 @@ class Series(base.IndexOpsMixin, NDFrame): # type: ignore[misc] See the :ref:`user guide ` for more usages. name : Hashable, default None The name to give to the Series. - copy : bool, default False - Copy input data. Only affects Series or 1d ndarray input. See examples. + copy : bool, default None + Copy input data. By default, will copy if the input data is a numpy or + pandas array. Set to False to avoid copying, at your own risk (if you + know the input data won't be modified elsewhere). + Only affects Series or 1d ndarray input. See examples. See Also -------- From ee645f046c8078064869042835f466473b7c7785 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Fri, 12 Dec 2025 10:45:02 +0100 Subject: [PATCH 2/4] rephrase --- pandas/core/series.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index 089d000e15115..7aac2d6aab916 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -266,10 +266,12 @@ class Series(base.IndexOpsMixin, NDFrame): # type: ignore[misc] name : Hashable, default None The name to give to the Series. copy : bool, default None - Copy input data. By default, will copy if the input data is a numpy or - pandas array. Set to False to avoid copying, at your own risk (if you + Whether to copy input data. Only affects array or Series/Index input, + because for other input (e.g. a list) a new array is created anyway. + By default, will copy if the input data is a numpy or pandas array. + For Series/Index input, a shallow copy of the data is made by default. + Set to False to avoid copying array input, at your own risk (if you know the input data won't be modified elsewhere). - Only affects Series or 1d ndarray input. See examples. See Also -------- From 17389bfae7010409b1451037254c89f4acd4d0cb Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Sun, 14 Dec 2025 10:20:18 +0100 Subject: [PATCH 3/4] Update pandas/core/series.py Co-authored-by: Richard Shadrach <45562402+rhshadrach@users.noreply.github.com> --- 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 7aac2d6aab916..e5e44fe60d33f 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -270,7 +270,7 @@ class Series(base.IndexOpsMixin, NDFrame): # type: ignore[misc] because for other input (e.g. a list) a new array is created anyway. By default, will copy if the input data is a numpy or pandas array. For Series/Index input, a shallow copy of the data is made by default. - Set to False to avoid copying array input, at your own risk (if you + Set to False to avoid copying array input at your own risk (if you know the input data won't be modified elsewhere). See Also From 2d38fc47e9e810b5f2b1fc989787173d7c88251c Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Sun, 14 Dec 2025 16:01:28 +0100 Subject: [PATCH 4/4] rephrase --- pandas/core/series.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index e5e44fe60d33f..7c949952801ca 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -266,12 +266,13 @@ class Series(base.IndexOpsMixin, NDFrame): # type: ignore[misc] name : Hashable, default None The name to give to the Series. copy : bool, default None - Whether to copy input data. Only affects array or Series/Index input, - because for other input (e.g. a list) a new array is created anyway. - By default, will copy if the input data is a numpy or pandas array. - For Series/Index input, a shallow copy of the data is made by default. + Whether to copy input data, only relevant for array, Series, and Index + inputs (for other input, e.g. a list, a new array is created anyway). + Defaults to True for array input and False for Index/Series. + Even when False for Index/Series, a shallow copy of the data is made. Set to False to avoid copying array input at your own risk (if you know the input data won't be modified elsewhere). + Set to True to force copying Series/Index input up front. See Also --------