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: TimedeltaArray+Period, PeriodArray-TimedeltaArray #33883

Merged
merged 3 commits into from
May 13, 2020

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

motivated by the FIXME comment in test_timedelta64.py

@jorisvandenbossche
Copy link
Member

Can you explain what this PR is changing?

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.

pls add a whatsnew note.

@jreback jreback added Period Period data type Timedelta Timedelta data type labels Apr 30, 2020
@jreback
Copy link
Contributor

jreback commented Apr 30, 2020

can you also add an example in the docs (maybe in the timedelta section)

@jreback jreback added this to the 1.1 milestone May 2, 2020
@jbrockmendel
Copy link
Member Author

Can you explain what this PR is changing?

PeriodIndex - TimedeltaIndex always raises in master, but for some freq combinations should not. This fixes that.

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.

lgtm. can you add a whatsnew note.

msg = r"Input has different freq=None from PeriodArray\(freq=Q-DEC\)"
with pytest.raises(IncompatibleFrequency, match=msg):
msg = r"Cannot add or subtract timedelta64\[ns\] dtype from period\[Q-DEC\]"
with pytest.raises(TypeError, match=msg):
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't IncompatibleFrequency inherit from ValueError? so this is technically an api change (ok though)

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, this is a change. in the whatsnew i called it a bugfix

@jreback jreback merged commit 699b56f into pandas-dev:master May 13, 2020
@jreback
Copy link
Contributor

jreback commented May 13, 2020

thanks

@jbrockmendel jbrockmendel deleted the bug-sub-period branch May 13, 2020 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Period Period data type Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants