You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v0.21.0.txt
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -303,6 +303,8 @@ length 2+ levels, so a :class:`MultiIndex` is always returned from all of the
303
303
UTC Localization with Series
304
304
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
305
305
306
+
Previously, :func:`to_datetime` did not localize datetime ``Series`` data as when ``utc=True`` was passed. Now, :func:`to_datetime` will correctly localize `Series` with a `datetime64[ns, UTC]` data type. (:issue:`6415`).
307
+
306
308
Previous Behavior
307
309
308
310
.. ipython:: python
@@ -331,7 +333,7 @@ UTC Localization with Series
331
333
332
334
pd.to_datetime(s, utc=True)
333
335
334
-
This new behavior will also localize datetime columns in DataFrames returned from :func:`read_sql` which previously returned datetime columns as naive UTC.
336
+
Additionally, DataFrames with datetime columns returned by :func:`read_sql` will also be localized to UTC only if the original SQL columns were timezone aware datetime columns.
0 commit comments