BUG: DataFrame.update() drops timezone info · Issue #25807 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@GrivIN

Description

@GrivIN

Code Sample

import pandas as pd import datetime as dt import pytz as tz data = pd.DataFrame([{'localized_date': dt.datetime(2018, 1, 12, 8, 15, tzinfo=tz.timezone('Europe/Berlin'))}]) data """ localized_date 0 2018-01-12 08:22:00+01:00 """ data.dtypes """ localized_date datetime64[ns, Europe/Berlin] dtype: object """ data.update(data) data """ localized_date 0 2018-01-12 07:22:00 """ data.dtypes """ localized_date datetime64[ns] dtype: object """

Problem description

Update() method drops timezone info for datetime columns and cast all values to utc without a warning.

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.6.7.final.0 python-bits: 64 OS: Linux OS-release: 4.15.0-46-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8

pandas: 0.24.2
pytest: None
pip: 9.0.1
setuptools: 39.0.1
Cython: None
numpy: 1.16.2
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.8.0
pytz: 2018.9
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml.etree: None
bs4: None
html5lib: 0.999999999
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None