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

BUG: adding np.timedelta64 to DatetimeIndex with tz outputs incorrect #6818

Merged
merged 1 commit into from Apr 7, 2014

Conversation

Projects
None yet
2 participants
@sinhrks
Copy link
Member

commented Apr 6, 2014

>>> idx = pd.date_range(start='2010-11-02 01:00:00', periods=3, tz='US/Pacific', freq='1H')

>>> idx + offsets.Hour(3)
[2010-11-02 04:00:00-07:00, ..., 2010-11-02 06:00:00-07:00]
Length: 3, Freq: H, Timezone: US/Pacific

>>> idx + datetime.timedelta(hours=3)
[2010-11-02 04:00:00-07:00, ..., 2010-11-02 06:00:00-07:00]
Length: 3, Freq: H, Timezone: US/Pacific

>>> idx + np.timedelta64(3, 'h')          # incorrect
[2010-11-02 11:00:00-07:00, ..., 2010-11-02 13:00:00-07:00]
Length: 3, Freq: H, Timezone: US/Pacific

@jreback jreback added Bug labels Apr 6, 2014

@jreback jreback added this to the 0.14.0 milestone Apr 6, 2014

@jreback

This comment has been minimized.

Copy link
Contributor

commented Apr 6, 2014

looks good

@jreback

View changes

pandas/tseries/tests/test_timezones.py Outdated
@@ -961,6 +962,20 @@ def test_tzaware_offset(self):
offset = dates + offsets.Hour(5)
self.assertEqual(dates[0] + offsets.Hour(5), offset[0])

for tz in ['UTC', 'US/Pacific', 'Asia/Tokyo']:

This comment has been minimized.

Copy link
@jreback

jreback Apr 6, 2014

Contributor

trivial, but can you add the issue number (in this case PR number), as a comment near tests, easier reference for later

@sinhrks

This comment has been minimized.

Copy link
Member Author

commented Apr 7, 2014

OK, I've added a comment and rebased. There seems to be unnecessary line remains in release.rst thus removed it.

jreback added a commit that referenced this pull request Apr 7, 2014

Merge pull request #6818 from sinhrks/timedelta64
BUG: adding np.timedelta64 to DatetimeIndex with tz outputs incorrect

@jreback jreback merged commit ee1923c into pandas-dev:master Apr 7, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@sinhrks sinhrks deleted the sinhrks:timedelta64 branch Apr 12, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.