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
10 changes: 6 additions & 4 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6340,10 +6340,12 @@ def astype(
mapping, e.g. {col: dtype, ...}, where col is a column label and dtype is
a numpy.dtype or Python type to cast one or more of the DataFrame's
columns to column-specific types.
copy : bool, default False
Return a copy when ``copy=True`` (be very careful setting
``copy=False`` as changes to values then may propagate to other
pandas objects).
copy : bool or None, default None
Whether to copy the data or not.
- True : always return a new object.
- False : try to avoid copying and return a view if possible.
Copy link
Member

Choose a reason for hiding this comment

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

With copy-on-write now the default, this seems misleading to me.

- None : use the default lazy-copy behavior (recommended).
Copy link
Member

Choose a reason for hiding this comment

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

The type-hint is for no_default, not None. Also the wording here suggests to me that not specifying None does not use the default lazy-copy behavior.

.. note::
The `copy` keyword will change behavior in pandas 3.0.
Expand Down
Loading