Skip to content

Commit 286e7a3

Browse files
agartlandjreback
authored andcommitted
Updated docstring for copy() method
closes #12663 Added note that a copy with `deep=True` does not copy the data of objects contained in underlying arrays with `dtype=object`. Author: Andrew Fiore-Gartland <[email protected]> Closes #12664 from agartland/agartland-copy-doc and squashes the following commits: 3660bc1 [Andrew Fiore-Gartland] Explicit description of deep for True and False ece5d46 [Andrew Fiore-Gartland] Updated docstring for copy() method
1 parent b56f17f commit 286e7a3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pandas/core/generic.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -2947,12 +2947,18 @@ def astype(self, dtype, copy=True, raise_on_error=True, **kwargs):
29472947

29482948
def copy(self, deep=True):
29492949
"""
2950-
Make a copy of this object
2950+
Make a copy of this objects data.
29512951
29522952
Parameters
29532953
----------
29542954
deep : boolean or string, default True
2955-
Make a deep copy, i.e. also copy data
2955+
Make a deep copy, including a copy of the data and the indices.
2956+
With ``deep=False`` neither the indices or the data are copied.
2957+
2958+
Note that when ``deep=True`` data is copied, actual python objects
2959+
will not be copied recursively, only the reference to the object.
2960+
This is in contrast to ``copy.deepcopy`` in the Standard Library,
2961+
which recursively copies object data.
29562962
29572963
Returns
29582964
-------

0 commit comments

Comments
 (0)