Skip to content
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

msgpack drops timezone info #25148

Closed
ismell opened this issue Feb 4, 2019 · 2 comments
Closed

msgpack drops timezone info #25148

ismell opened this issue Feb 4, 2019 · 2 comments

Comments

@ismell
Copy link

ismell commented Feb 4, 2019

Code Sample, a copy-pastable example if possible

import numpy as np
import pandas as pd

idx = pd.DatetimeIndex(start='2018-12-02 14:50:00-07:00', end='2018-12-03 03:11:00-07:00', freq='1min')

df = pd.DataFrame(np.random.randn(len(idx), 1), index=idx, columns=['A'])

df.index[0]
# Timestamp('2018-12-02 14:50:00-0700', tz='pytz.FixedOffset(-420)', freq='T')

df.to_msgpack('foo.msgpack')

df = pd.read_msgpack('foo.msgpack')
df.index[0]
# Timestamp('2018-12-02 21:50:00', freq='T')

Problem description

to_msgpack should encode the timezone information. Or read_msgpack should return a timezone aware timestamp with UTC as the timezone.

Expected Output

df = pd.read_msgpack('foo.msgpack')
df.index[0]
# Timestamp('2018-12-02 14:50:00-0700', tz='pytz.FixedOffset(-420)', freq='T')

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.7.0.final.0
python-bits: 64
OS: Linux
OS-release: 4.18.10-1rodete2-amd64
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.23.4
pytest: None
pip: 18.1
setuptools: 40.6.2
Cython: None
numpy: 1.15.4
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.7.5
pytz: 2018.7
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 3.0.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@TomAugspurger TomAugspurger added this to the Contributions Welcome milestone Feb 4, 2019
@TomAugspurger
Copy link
Contributor

Ideally this fix would work for all extension arrays, not just datetime-tz.

cgangwar11 added a commit to cgangwar11/pandas that referenced this issue Feb 6, 2019
@simonjayhawkins
Copy link
Member

msgpack is deprecated #30112

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

Successfully merging a pull request may close this issue.

4 participants