-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Bug: Timestamp removes timezone localization #15777
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
Comments
@mroeschke some additional DST crossing examples in #15823 |
Thanks @jreback. I believe I found the issue here: https://github.com/pandas-dev/pandas/blob/master/pandas/_libs/tslib.pyx#L220. In |
yeah the treatment is prob a bit off. see also note that happy to have this restructued btw. odd that more things are not failing. |
Unfortunately my initial suggestion did not fix the issue after playing around with it. On a related note, it seems like localizing a naive
|
these conceptually HAVE to be different. The timezone on a single localized timestamp is defined exactly. However, the string tz on a DatetimeIndex is something like 'US/Pacific', it cannot itself be localized because it doesn't have a reference date. It actually has many reference dates (e.g. each point in the index). So which one shall you pick? so the tzinfo on a DTI is just today's I think. Note in practice this doesn't actually make any difference, its just a display thing. |
Ah okay that makes sense that a DatetimeIndex has multiple reference dates while a Timestamp has a definitive reference date, and that this is a display thing. |
Problem description
Localization of the timezone should be maintained when creating a Timestamp. I also believe this is the root issue of #13238 since
resample()
callsgroupby()
which (I think) reconstructs the index with Timestamps.Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: 92239f5
python: 2.7.12.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-45-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.19.0+644.g92239f5.dirty
pytest: 3.0.6
pip: 8.1.2
setuptools: 27.2.0
Cython: 0.24.1
numpy: 1.11.2
scipy: None
xarray: None
IPython: 5.1.0
sphinx: 1.4.8
patsy: None
dateutil: 2.5.3
pytz: 2016.7
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 1.5.3
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
s3fs: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: