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
20 changes: 6 additions & 14 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6354,23 +6354,15 @@ def astype(
a numpy.dtype or Python type to cast one or more of the DataFrame's
columns to column-specific types.
copy : bool, default False
Copy link
Member Author

Choose a reason for hiding this comment

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

Since no one should specify this keyword, we could also just leave out the type part entirely?

Suggested change
copy : bool, default False
copy

(probably would need to suppress some numpydoc linting rule for this method, though)

Copy link
Member

Choose a reason for hiding this comment

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

In general for a deprecated parameter, I think we should still keep the type/default/description even if we don't want users to use it. In this case I would update the description to something like

This keyword is now ignored; changing its value will have no impact on the method.

Return a copy when ``copy=True`` (be very careful setting
``copy=False`` as changes to values then may propagate to other
pandas objects).
.. deprecated:: 3.0.0

.. note::
The `copy` keyword will change behavior in pandas 3.0.
`Copy-on-Write
This keyword is ignored and will be removed in pandas 4.0. Since
pandas 3.0, this method always returns a new object using a lazy
copy mechanism that defers copies until necessary
(Copy-on-Write). See the `user guide on Copy-on-Write
<https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html>`__
will be enabled by default, which means that all methods with a
`copy` keyword will use a lazy copy mechanism to defer the copy and
ignore the `copy` keyword. The `copy` keyword will be removed in a
future version of pandas.

You can already get the future behavior and improvements through
enabling copy on write ``pd.options.mode.copy_on_write = True``
for more details.

.. deprecated:: 3.0.0
errors : {'raise', 'ignore'}, default 'raise'
Control raising of exceptions on invalid data for provided dtype.

Expand Down
Loading