From 4ade1d085672ce347e36dbb998a8fa22d6baa678 Mon Sep 17 00:00:00 2001 From: Rustam Ali Date: Wed, 19 Nov 2025 07:43:37 +0530 Subject: [PATCH] DOC: Correct typing of 'copy' argument in astype docstring (#63144) --- pandas/core/generic.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 940231233e308..57f180da455ca 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -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. + - None : use the default lazy-copy behavior (recommended). .. note:: The `copy` keyword will change behavior in pandas 3.0.