Skip to content

BUG: DataFrame.update() drops timezone info #25807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
GrivIN opened this issue Mar 20, 2019 · 1 comment · Fixed by #25810
Closed

BUG: DataFrame.update() drops timezone info #25807

GrivIN opened this issue Mar 20, 2019 · 1 comment · Fixed by #25810
Labels
Bug Timezones Timezone data dtype
Milestone

Comments

@GrivIN
Copy link

GrivIN commented Mar 20, 2019

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

@jreback
Copy link
Contributor

jreback commented Mar 20, 2019

pls search for a duplicate issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants