Skip to content

[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

Merged
merged 3 commits into from
May 12, 2019

Conversation

makbigc
Copy link
Contributor

@makbigc makbigc commented May 6, 2019

@codecov
Copy link

codecov bot commented May 6, 2019

Codecov Report

Merging #26292 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 90.53% <100%> (ø) ⬆️
#single 40.71% <0%> (-0.16%) ⬇️
Impacted Files Coverage Δ
pandas/tseries/offsets.py 96.69% <100%> (ø) ⬆️
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
pandas/core/frame.py 96.9% <0%> (-0.12%) ⬇️
pandas/util/testing.py 90.71% <0%> (+0.1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7120725...04d5351. Read the comment docs.

@codecov
Copy link

codecov bot commented May 6, 2019

Codecov Report

Merging #26292 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 90.59% <100%> (ø) ⬆️
#single 40.72% <0%> (-0.15%) ⬇️
Impacted Files Coverage Δ
pandas/tseries/offsets.py 96.69% <100%> (ø) ⬆️
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
pandas/core/frame.py 97.01% <0%> (-0.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d7ba05...e6da6bd. Read the comment docs.

@gfyoung gfyoung added Bug Frequency DateOffsets Datetime Datetime data dtype labels May 6, 2019
exp = DatetimeIndex([Timestamp('2014-04-11'), Timestamp('2015-04-11'),
Timestamp('2016-04-11'), Timestamp('2017-04-11')])
tm.assert_equal(result, exp)

Copy link
Member

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')
Copy link
Contributor

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
Copy link
Contributor

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

@makbigc makbigc force-pushed the bug-fix-GH26258 branch from 04d5351 to e6da6bd Compare May 8, 2019 05:11
@makbigc
Copy link
Contributor Author

makbigc commented May 11, 2019

@jreback Do you have anything else to implement? Please tell me.

@jreback jreback added this to the 0.25.0 milestone May 12, 2019
@jreback jreback merged commit bc75a72 into pandas-dev:master May 12, 2019
@jreback
Copy link
Contributor

jreback commented May 12, 2019

thanks @makbigc keep em coming!

DatetimeIndex([Timestamp('2013-10-01'), Timestamp('2014-10-01'),
Timestamp('2015-10-01'), Timestamp('2016-10-01')]))

])
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype Frequency DateOffsets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding offset to DatetimeIndex is broken
4 participants