Skip to content

Commit 5411cab

Browse files
committed
reflow
1 parent 35cd733 commit 5411cab

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

doc/source/whatsnew/v0.24.0.rst

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,31 +1369,30 @@ The default behavior remains the same, but issues a warning:
13691369
13701370
In [3]: pd.DatetimeIndex([946684800000000000], tz="US/Central")
13711371
/bin/ipython:1: FutureWarning:
1372-
Passing integer-dtype data and a timezone to DatetimeIndex.
1373-
Integer values will be interpreted differently in a future version
1374-
of pandas. Previously, these were viewed as datetime64[ns] values
1375-
representing the wall time *in the specified timezone*.
1376-
In the future, these will be viewed as datetime64[ns] values
1377-
representing the wall time *in UTC*. This is similar to a
1378-
nanosecond-precision UNIX epoch.
1379-
To accept the future behavior, use
1372+
Passing integer-dtype data and a timezone to DatetimeIndex. Integer values
1373+
will be interpreted differently in a future version of pandas. Previously,
1374+
these were viewed as datetime64[ns] values representing the wall time
1375+
*in the specified timezone*. In the future, these will be viewed as
1376+
datetime64[ns] values representing the wall time *in UTC*. This is similar
1377+
to a nanosecond-precision UNIX epoch. To accept the future behavior, use
13801378
13811379
pd.to_datetime(integer_data, utc=True).tz_convert(tz)
13821380
13831381
To keep the previous behavior, use
13841382
1385-
pd.to_datetime(integer_data).tz_localize(tz)
1383+
pd.to_datetime(integer_data).tz_localize(tz)
13861384
1387-
#!/bin/python3
1385+
#!/bin/python3
13881386
Out[3]: DatetimeIndex(['2000-01-01 00:00:00-06:00'], dtype='datetime64[ns, US/Central]', freq=None)
13891387
1390-
As the warning message explains, opt in to the future behavior with
1388+
As the warning message explains, opt in to the future behavior by specifying that
1389+
the integer values are UTC, and then converting to the final timezone:
13911390

13921391
.. ipython:: python
13931392
13941393
pd.to_datetime([946684800000000000], utc=True).tz_convert('US/Central')
13951394
1396-
And the old behavior can be retained with
1395+
The old behavior can be retained with by localizing directly to the final timezone:
13971396

13981397
.. ipython:: python
13991398

pandas/core/arrays/datetimes.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,12 @@
3434

3535
_midnight = time(0, 0)
3636
_i8_message = """
37-
Passing integer-dtype data and a timezone to DatetimeIndex.
38-
Integer values will be interpreted differently in a future version
39-
of pandas. Previously, these were viewed as datetime64[ns] values
40-
representing the wall time *in the specified timezone*.
41-
In the future, these will be viewed as datetime64[ns] values
42-
representing the wall time *in UTC*. This is similar to a
43-
nanosecond-precision UNIX epoch.
44-
To accept the future behavior, use
37+
Passing integer-dtype data and a timezone to DatetimeIndex. Integer values
38+
will be interpreted differently in a future version of pandas. Previously,
39+
these were viewed as datetime64[ns] values representing the wall time
40+
*in the specified timezone*. In the future, these will be viewed as
41+
datetime64[ns] values representing the wall time *in UTC*. This is similar
42+
to a nanosecond-precision UNIX epoch. To accept the future behavior, use
4543
4644
pd.to_datetime(integer_data, utc=True).tz_convert(tz)
4745

0 commit comments

Comments
 (0)