Skip to content
Open
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: 7 additions & 2 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,13 @@ class Series(base.IndexOpsMixin, NDFrame): # type: ignore[misc]
See the :ref:`user guide <basics.dtypes>` 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 link
Member Author

@jorisvandenbossche jorisvandenbossche Dec 12, 2025

Choose a reason for hiding this comment

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

Related to #63144, the question is what to put here in the docstring ..

copy=None is closest to what is in the signature, but is not really meaningful by itself. Of course, the behaviour also depends on the intput, so writing that it defaults to either True or False will also be misleading for some cases.
(eg the current default False in the docstring above is not correct for array input)

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with None here, I think the behavior is too complex to give a meaningful description in the space allowed.

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.
Copy link
Member

@rhshadrach rhshadrach Dec 12, 2025

Choose a reason for hiding this comment

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

It's not quite clear to me what happens if you set it to False in the Series/Index case.

Set to False to avoid copying array input, at your own risk (if you
Copy link
Member

Choose a reason for hiding this comment

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

nit: no comma.

Suggested change
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
--------
Expand Down
Loading