Skip to content

BUG: Index with integer data and datetime64[ns, tz] dtype does not localize correctly #20964

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
mroeschke opened this issue May 6, 2018 · 1 comment · Fixed by #21216
Closed
Labels
Bug Timezones Timezone data dtype
Milestone

Comments

@mroeschke
Copy link
Member

In [1]: pd.__version__
Out[1]: '0.23.0rc2+16.gccf4b96.dirty'

In [2]: val = [pd.Timestamp('2018-01-01', tz='US/Pacific').value]

In [3]: pd.Index(val, dtype='datetime64[ns, US/Pacific]')
Out[3]: DatetimeIndex(['2018-01-01 08:00:00-08:00'], dtype='datetime64[ns, US/Pacific]', freq=None)

The localization appears to localize directly to the timezone instead of localizing first to UTC and therefore does not roundtrip correctly from the timestamp value.

#20956 can be simplified once this is fixed.

Expected:

Out[3]: DatetimeIndex(['2018-01-01 00:00:00-08:00'], dtype='datetime64[ns, US/Pacific]', freq=None)
@mroeschke mroeschke changed the title BUG: Index with datetime64[ns, tz] dtype does not localize correctly BUG: Index with integer data and datetime64[ns, tz] dtype does not localize correctly May 7, 2018
@gfyoung gfyoung added Timezones Timezone data dtype Bug labels May 8, 2018
@jreback
Copy link
Contributor

jreback commented May 10, 2018

hmm I think there is an open issue about this already, if you'd have a look

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