handle NaT add/sub in one place#19903
Merged
jreback merged 3 commits intopandas-dev:masterfrom Feb 27, 2018
Merged
Conversation
jbrockmendel
commented
Feb 26, 2018
| nanos = delta_to_nanoseconds(other) | ||
| offset_nanos = delta_to_nanoseconds(offset) | ||
| if (nanos % offset_nanos).all() == 0: | ||
| return nanos // offset_nanos |
Member
Author
There was a problem hiding this comment.
This block is never reached b/c there is a separate check for np.ndarray before this.
Codecov Report
@@ Coverage Diff @@
## master #19903 +/- ##
==========================================
+ Coverage 91.66% 91.67% +<.01%
==========================================
Files 150 150
Lines 48969 48967 -2
==========================================
+ Hits 44886 44889 +3
+ Misses 4083 4078 -5
Continue to review full report at Codecov.
|
Contributor
|
thanks |
harisbal
pushed a commit
to harisbal/pandas
that referenced
this pull request
Feb 28, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ATM DatetimeIndex/TimedeltaIndex/PeriodIndex each have special-casing for addition/subtraction of NaT. This checks for NaT up-front and puts all of that logic into add_nat and sub_nat methods.
Also makes another step towards centralizing all of the wrapping of the add/sub ops at the end of
__add__and__sub__.Should be orthogonal to other outstanding PRs, albeit just barely.