Skip to content

check for datetime+period addition #18524

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 2 commits into from
Nov 29, 2017

Conversation

jbrockmendel
Copy link
Member

@jbrockmendel jbrockmendel commented Nov 27, 2017

@gfyoung gfyoung added Period Period data type Datetime Datetime data dtype labels Nov 27, 2017
ts = pd.Timestamp('2017')
per = pd.Period('2017', freq='M')

with pytest.raises(TypeError):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make sure that the right error message is hit (use tm.assert_raises_regex to be safe, unclear ATM whether we're going to leverage the most recent pytest API).

@gfyoung
Copy link
Member

gfyoung commented Nov 27, 2017

@jbrockmendel : Don't forget the whatsnew also 😄

@codecov
Copy link

codecov bot commented Nov 27, 2017

Codecov Report

Merging #18524 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18524      +/-   ##
==========================================
+ Coverage   91.32%   91.33%   +<.01%     
==========================================
  Files         163      163              
  Lines       49798    49798              
==========================================
+ Hits        45479    45483       +4     
+ Misses       4319     4315       -4
Flag Coverage Δ
#multiple 89.13% <ø> (+0.02%) ⬆️
#single 40.79% <ø> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.81% <0%> (-0.1%) ⬇️
pandas/core/indexes/datetimes.py 95.71% <0%> (+0.09%) ⬆️
pandas/plotting/_converter.py 65.25% <0%> (+1.81%) ⬆️

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 262e8ff...2d824c8. Read the comment docs.

@codecov
Copy link

codecov bot commented Nov 27, 2017

Codecov Report

Merging #18524 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18524      +/-   ##
==========================================
+ Coverage   91.32%   91.33%   +<.01%     
==========================================
  Files         163      164       +1     
  Lines       49798    49801       +3     
==========================================
+ Hits        45479    45485       +6     
+ Misses       4319     4316       -3
Flag Coverage Δ
#multiple 89.13% <ø> (+0.02%) ⬆️
#single 40.81% <ø> (-0.05%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.81% <0%> (-0.1%) ⬇️
pandas/tseries/offsets.py 96.9% <0%> (-0.05%) ⬇️
pandas/util/_test_decorators.py 95.23% <0%> (ø)
pandas/core/indexes/datetimes.py 95.71% <0%> (+0.09%) ⬆️
pandas/plotting/_converter.py 65.25% <0%> (+1.81%) ⬆️

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 262e8ff...c79ba87. Read the comment docs.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a whatsnew note (0.22.0)

lbox(ts) + rbox(per)

with pytest.raises(TypeError):
lbox(per) + rbox(ts)
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 add a similar test with Series of periods & Timestamp; I think these are now in pandas/tests/series/test_timestamp.py IIRC (maybe make a test_period.py in series ok too).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woops, just pushed without addressing this. Do you mean a Series that mixed, contains both Periods and Timestamps?


with tm.assert_raises_regex(TypeError, msg):
lbox(per) + rbox(per)

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 add similar tests for sub

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK for todo list? I'd like to keep this narrow, busy day ahead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@jbrockmendel jbrockmendel mentioned this pull request Nov 28, 2017
59 tasks
@jreback jreback added this to the 0.22.0 milestone Nov 29, 2017
@jreback jreback merged commit 7627cca into pandas-dev:master Nov 29, 2017
@jreback
Copy link
Contributor

jreback commented Nov 29, 2017

thanks!

@jreback
Copy link
Contributor

jreback commented Nov 29, 2017

doesn't seem to fix: #18205 but maybe helps

@jbrockmendel
Copy link
Member Author

doesn't seem to fix: #18205 but maybe helps

Unrelated. But that's high on my personal list, along with getting DateOffsets to be immutable.

@jbrockmendel jbrockmendel deleted the period_plus_datetime branch November 29, 2017 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Period Period data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Series[Period] and Timestamp binop causes segfault
3 participants