Skip to content

Commit

Permalink
DOC: Remove deprecated example for astype (pandas-dev#41381)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhshadrach authored May 10, 2021
1 parent f570ba2 commit afab8e3
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit afab8e3

Please sign in to comment.