Skip to content

Commit 47fea80

Browse files
DOC: update description for deprecated copy keyword in docstrings (CoW is now in effect) (#63297)
1 parent 8229df0 commit 47fea80

File tree

5 files changed

+209
-288
lines changed

5 files changed

+209
-288
lines changed

pandas/core/frame.py

Lines changed: 45 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -379,21 +379,18 @@
379379
`right` should be left as-is, with no suffix. At least one of the
380380
values must not be None.
381381
copy : bool, default False
382-
If False, avoid copy if possible.
382+
This keyword is now ignored; changing its value will have no
383+
impact on the method.
383384
384-
.. note::
385-
The `copy` keyword will change behavior in pandas 3.0.
386-
`Copy-on-Write
387-
<https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
388-
will be enabled by default, which means that all methods with a
389-
`copy` keyword will use a lazy copy mechanism to defer the copy and
390-
ignore the `copy` keyword. The `copy` keyword will be removed in a
391-
future version of pandas.
385+
.. deprecated:: 3.0.0
392386
393-
You can already get the future behavior and improvements through
394-
enabling copy on write ``pd.options.mode.copy_on_write = True``
387+
This keyword is ignored and will be removed in pandas 4.0. Since
388+
pandas 3.0, this method always returns a new object using a lazy
389+
copy mechanism that defers copies until necessary
390+
(Copy-on-Write). See the `user guide on Copy-on-Write
391+
<https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
392+
for more details.
395393
396-
.. deprecated:: 3.0.0
397394
indicator : bool or str, default False
398395
If True, adds a column to the output DataFrame called "_merge" with
399396
information on the source of each row. The column can be given a different
@@ -3900,26 +3897,21 @@ def transpose(
39003897
*args : tuple, optional
39013898
Accepted for compatibility with NumPy.
39023899
copy : bool, default False
3903-
Whether to copy the data after transposing, even for DataFrames
3904-
with a single dtype.
3900+
This keyword is now ignored; changing its value will have no
3901+
impact on the method.
39053902
39063903
Note that a copy is always required for mixed dtype DataFrames,
39073904
or for DataFrames with any extension types.
39083905
3909-
.. note::
3910-
The `copy` keyword will change behavior in pandas 3.0.
3911-
`Copy-on-Write
3912-
<https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
3913-
will be enabled by default, which means that all methods with a
3914-
`copy` keyword will use a lazy copy mechanism to defer the copy and
3915-
ignore the `copy` keyword. The `copy` keyword will be removed in a
3916-
future version of pandas.
3917-
3918-
You can already get the future behavior and improvements through
3919-
enabling copy on write ``pd.options.mode.copy_on_write = True``
3920-
39213906
.. deprecated:: 3.0.0
39223907
3908+
This keyword is ignored and will be removed in pandas 4.0. Since
3909+
pandas 3.0, this method always returns a new object using a lazy
3910+
copy mechanism that defers copies until necessary
3911+
(Copy-on-Write). See the `user guide on Copy-on-Write
3912+
<https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
3913+
for more details.
3914+
39233915
Returns
39243916
-------
39253917
DataFrame
@@ -5949,21 +5941,18 @@ def rename(
59495941
Axis to target with ``mapper``. Can be either the axis name
59505942
('index', 'columns') or number (0, 1). The default is 'index'.
59515943
copy : bool, default False
5952-
Also copy underlying data.
5944+
This keyword is now ignored; changing its value will have no
5945+
impact on the method.
59535946
5954-
.. note::
5955-
The `copy` keyword will change behavior in pandas 3.0.
5956-
`Copy-on-Write
5957-
<https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
5958-
will be enabled by default, which means that all methods with a
5959-
`copy` keyword will use a lazy copy mechanism to defer the copy and
5960-
ignore the `copy` keyword. The `copy` keyword will be removed in a
5961-
future version of pandas.
5947+
.. deprecated:: 3.0.0
59625948
5963-
You can already get the future behavior and improvements through
5964-
enabling copy on write ``pd.options.mode.copy_on_write = True``
5949+
This keyword is ignored and will be removed in pandas 4.0. Since
5950+
pandas 3.0, this method always returns a new object using a lazy
5951+
copy mechanism that defers copies until necessary
5952+
(Copy-on-Write). See the `user guide on Copy-on-Write
5953+
<https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
5954+
for more details.
59655955
5966-
.. deprecated:: 3.0.0
59675956
inplace : bool, default False
59685957
Whether to modify the DataFrame rather than creating a new one.
59695958
If True then value of copy is ignored.
@@ -13988,22 +13977,18 @@ def to_timestamp(
1398813977
axis : {0 or 'index', 1 or 'columns'}, default 0
1398913978
The axis to convert (the index by default).
1399013979
copy : bool, default False
13991-
If False then underlying input data is not copied.
13992-
13993-
.. note::
13994-
The `copy` keyword will change behavior in pandas 3.0.
13995-
`Copy-on-Write
13996-
<https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
13997-
will be enabled by default, which means that all methods with a
13998-
`copy` keyword will use a lazy copy mechanism to defer the copy and
13999-
ignore the `copy` keyword. The `copy` keyword will be removed in a
14000-
future version of pandas.
14001-
14002-
You can already get the future behavior and improvements through
14003-
enabling copy on write ``pd.options.mode.copy_on_write = True``
13980+
This keyword is now ignored; changing its value will have no
13981+
impact on the method.
1400413982
1400513983
.. deprecated:: 3.0.0
1400613984
13985+
This keyword is ignored and will be removed in pandas 4.0. Since
13986+
pandas 3.0, this method always returns a new object using a lazy
13987+
copy mechanism that defers copies until necessary
13988+
(Copy-on-Write). See the `user guide on Copy-on-Write
13989+
<https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
13990+
for more details.
13991+
1400713992
Returns
1400813993
-------
1400913994
DataFrame with DatetimeIndex
@@ -14078,22 +14063,18 @@ def to_period(
1407814063
axis : {0 or 'index', 1 or 'columns'}, default 0
1407914064
The axis to convert (the index by default).
1408014065
copy : bool, default False
14081-
If False then underlying input data is not copied.
14082-
14083-
.. note::
14084-
The `copy` keyword will change behavior in pandas 3.0.
14085-
`Copy-on-Write
14086-
<https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
14087-
will be enabled by default, which means that all methods with a
14088-
`copy` keyword will use a lazy copy mechanism to defer the copy and
14089-
ignore the `copy` keyword. The `copy` keyword will be removed in a
14090-
future version of pandas.
14091-
14092-
You can already get the future behavior and improvements through
14093-
enabling copy on write ``pd.options.mode.copy_on_write = True``
14066+
This keyword is now ignored; changing its value will have no
14067+
impact on the method.
1409414068
1409514069
.. deprecated:: 3.0.0
1409614070
14071+
This keyword is ignored and will be removed in pandas 4.0. Since
14072+
pandas 3.0, this method always returns a new object using a lazy
14073+
copy mechanism that defers copies until necessary
14074+
(Copy-on-Write). See the `user guide on Copy-on-Write
14075+
<https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
14076+
for more details.
14077+
1409714078
Returns
1409814079
-------
1409914080
DataFrame

0 commit comments

Comments
 (0)