Skip to content

fix Timedelta.__mul__(NaT) #19819

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
Feb 22, 2018
Merged

fix Timedelta.__mul__(NaT) #19819

merged 2 commits into from
Feb 22, 2018

Conversation

jbrockmendel
Copy link
Member

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

@codecov
Copy link

codecov bot commented Feb 21, 2018

Codecov Report

Merging #19819 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #19819   +/-   ##
=======================================
  Coverage   91.61%   91.61%           
=======================================
  Files         150      150           
  Lines       48892    48892           
=======================================
  Hits        44792    44792           
  Misses       4100     4100
Flag Coverage Δ
#multiple 89.99% <ø> (ø) ⬆️
#single 41.79% <ø> (ø) ⬆️

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 aa59954...7d0d558. Read the comment docs.

@jreback jreback added Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Timedelta Timedelta data type labels Feb 22, 2018
def test_td_mul_nat(self, op, td_nat):
# GH#19819
td = Timedelta(10, unit='d')
with pytest.raises(TypeError):
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we raise on this again? what is the behavior on divide?

Copy link
Member Author

Choose a reason for hiding this comment

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

For the same reason we raise on Timedelta * timedelta (or Timedelta * datetime depending on what hat pd.NaT is wearing).

For division Timedelta / pd.NaT returns np.nan, which is already correct.

@jreback jreback added this to the 0.23.0 milestone Feb 22, 2018
@jreback jreback merged commit 399a96b into pandas-dev:master Feb 22, 2018
@jreback
Copy link
Contributor

jreback commented Feb 22, 2018

thanks

harisbal pushed a commit to harisbal/pandas that referenced this pull request Feb 28, 2018
@jbrockmendel jbrockmendel deleted the tdfixes6 branch June 22, 2018 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants