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
Previously, :func:`to_datetime` did not localize datetime ``Series`` data when ``utc=True`` was passed. Now, :func:`to_datetime` will correctly localize ``Series`` with a ``datetime64[ns, UTC]`` dtype to be consistent with how list-like and ``Index`` data are handled. (:issue:`6415`).
307
+
308
+
Previous Behavior
309
+
310
+
.. ipython:: python
311
+
312
+
s = Series(['20130101 00:00:00'] * 3)
313
+
314
+
.. code-block:: ipython
315
+
316
+
In [12]: pd.to_datetime(s, utc=True)
317
+
Out[12]:
318
+
0 2013-01-01
319
+
1 2013-01-01
320
+
2 2013-01-01
321
+
dtype: datetime64[ns]
322
+
323
+
New Behavior
324
+
325
+
.. ipython:: python
326
+
327
+
pd.to_datetime(s, utc=True)
328
+
329
+
Additionally, DataFrames with datetime columns that were parsed by :func:`read_sql_table` and :func:`read_sql_query` will also be localized to UTC only if the original SQL columns were timezone aware datetime columns.
0 commit comments