-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
BugTimedeltaTimedelta data typeTimedelta data typeTimezonesTimezone data dtypeTimezone data dtypegood first issue
Milestone
Description
When I add a time delta to a DatetimeIndex which is tz-aware, the results appear as UTC, but sometimes claim to be in the original non-UTC timezone.
Code
import pandas as pd index = pd.DatetimeIndex(['2016-06-28 05:30', '2016-06-28 05:31'], dtype='datetime64[ns, America/Chicago]') offset = pd.Series(['00:00:05', '00:00:05'], dtype='timedelta64[ns]', index=index) print(index + offset) print(index + offset.values) Actual Output
2016-06-28 05:30:00-05:00 2016-06-28 10:30:05 2016-06-28 05:31:00-05:00 2016-06-28 10:31:05 dtype: datetime64[ns] DatetimeIndex(['2016-06-28 10:30:05-05:00', '2016-06-28 10:31:05-05:00'], dtype='datetime64[ns, America/Chicago]', freq=None) Expected Output
2016-06-28 05:30:00-05:00 2016-06-28 05:30:05-05:00 2016-06-28 05:31:00-05:00 2016-06-28 05:31:05-05:00 dtype: datetime64[ns] DatetimeIndex(['2016-06-28 05:30:05-05:00', '2016-06-28 05:31:05-05:00'], dtype='datetime64[ns, America/Chicago]', freq=None) Note however that this does print the expected result:
print(index + pd.to_timedelta('00:00:05')) I'm using Pandas 0.18.1.
Metadata
Metadata
Assignees
Labels
BugTimedeltaTimedelta data typeTimedelta data typeTimezonesTimezone data dtypeTimezone data dtypegood first issue