From afab8e327951699305c474ae9e11fcf2a3812024 Mon Sep 17 00:00:00 2001 From: Richard Shadrach <45562402+rhshadrach@users.noreply.github.com> Date: Mon, 10 May 2021 19:29:34 -0400 Subject: [PATCH] DOC: Remove deprecated example for astype (#41381) --- pandas/core/generic.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index bf87ed74dde2f..0d39f13afc426 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -5686,6 +5686,14 @@ def astype( to_numeric : Convert argument to a numeric type. numpy.ndarray.astype : Cast a numpy array to a specified type. + Notes + ----- + .. deprecated:: 1.3.0 + + Using ``astype`` to convert from timezone-naive dtype to + timezone-aware dtype is deprecated and will raise in a + future version. Use :meth:`Series.dt.tz_localize` instead. + Examples -------- Create a DataFrame: @@ -5761,15 +5769,6 @@ def astype( 1 2020-01-02 2 2020-01-03 dtype: datetime64[ns] - - Datetimes are localized to UTC first before - converting to the specified timezone: - - >>> ser_date.astype('datetime64[ns, US/Eastern]') - 0 2019-12-31 19:00:00-05:00 - 1 2020-01-01 19:00:00-05:00 - 2 2020-01-02 19:00:00-05:00 - dtype: datetime64[ns, US/Eastern] """ if is_dict_like(dtype): if self.ndim == 1: # i.e. Series