-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
[BUG] Adding offset with nonzero month to DatetimeIndex (GH26258) #26292
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #26292 +/- ##
==========================================
- Coverage 91.98% 91.98% -0.01%
==========================================
Files 175 175
Lines 52374 52374
==========================================
- Hits 48178 48175 -3
- Misses 4196 4199 +3
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #26292 +/- ##
==========================================
- Coverage 92.04% 92.03% -0.01%
==========================================
Files 175 175
Lines 52291 52291
==========================================
- Hits 48131 48127 -4
- Misses 4160 4164 +4
Continue to review full report at Codecov.
|
exp = DatetimeIndex([Timestamp('2014-04-11'), Timestamp('2015-04-11'), | ||
Timestamp('2016-04-11'), Timestamp('2017-04-11')]) | ||
tm.assert_equal(result, exp) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this a separate test. We're moving towards smaller, more modular tests.
@@ -1370,6 +1370,14 @@ def test_dt64arr_add_sub_DateOffset(self, box_with_array): | |||
tm.assert_equal(result, exp) | |||
tm.assert_equal(result2, exp) | |||
|
|||
# GH 26258 | |||
date = date_range(start='01 Jan 2014', end='01 Jan 2017', freq='AS') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also test with just pd.DateOffset(months=3) as well
# GH 26258 | ||
date = date_range(start='01 Jan 2014', end='01 Jan 2017', freq='AS') | ||
offset = pd.DateOffset(months=3, days=10) | ||
result = date + offset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also pls test for subtraction too
@jreback Do you have anything else to implement? Please tell me. |
thanks @makbigc keep em coming! |
DatetimeIndex([Timestamp('2013-10-01'), Timestamp('2014-10-01'), | ||
Timestamp('2015-10-01'), Timestamp('2016-10-01')])) | ||
|
||
]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@makbigc I'm a little bit late to the party here, but can you do a follow-up to parametrize over box
to make sure the add/sub ops work for Series/DataFrame? Also tzaware and tz-naive.
git diff upstream/master -u -- "*.py" | flake8 --diff