Skip to content

Commit afab8e3

Browse files
authored
DOC: Remove deprecated example for astype (#41381)
1 parent f570ba2 commit afab8e3

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

pandas/core/generic.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5686,6 +5686,14 @@ def astype(
56865686
to_numeric : Convert argument to a numeric type.
56875687
numpy.ndarray.astype : Cast a numpy array to a specified type.
56885688
5689+
Notes
5690+
-----
5691+
.. deprecated:: 1.3.0
5692+
5693+
Using ``astype`` to convert from timezone-naive dtype to
5694+
timezone-aware dtype is deprecated and will raise in a
5695+
future version. Use :meth:`Series.dt.tz_localize` instead.
5696+
56895697
Examples
56905698
--------
56915699
Create a DataFrame:
@@ -5761,15 +5769,6 @@ def astype(
57615769
1 2020-01-02
57625770
2 2020-01-03
57635771
dtype: datetime64[ns]
5764-
5765-
Datetimes are localized to UTC first before
5766-
converting to the specified timezone:
5767-
5768-
>>> ser_date.astype('datetime64[ns, US/Eastern]')
5769-
0 2019-12-31 19:00:00-05:00
5770-
1 2020-01-01 19:00:00-05:00
5771-
2 2020-01-02 19:00:00-05:00
5772-
dtype: datetime64[ns, US/Eastern]
57735772
"""
57745773
if is_dict_like(dtype):
57755774
if self.ndim == 1: # i.e. Series

0 commit comments

Comments
 (0)