-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Catch overflow in both directions for checked add #14453
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: Catch overflow in both directions for checked add #14453
Conversation
@jreback : Doesn't seem like Appveyor is picking up this PR. |
Current coverage is 85.25% (diff: 68.75%)@@ master #14453 diff @@
==========================================
Files 140 140
Lines 50640 50654 +14
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43175 43184 +9
- Misses 7465 7470 +5
Partials 0 0
|
lgtm. can you add a whatsnew note. put in a new API Changes section in 0.19.1 |
Please no api change section for 0.19.1. We put it in the bug section for 0.19.0, so then can put it here there as well I think (we maybe should have put it in the api changes section for 0.19.0 ..) |
1) Add checks to ensure that add overflow does not occur both in the positive or negative directions. 2) Add benchmarks to ensure that operations involving this checked add function are significantly impacted.
88adc82
to
2dc49e4
Compare
bug fix section is fine |
@gfyoung Thanks! |
@jreback , @jorisvandenbossche : So while it's good that we're catching underflow, when I try to integrate this check with tdi + tdi OR tdi + td, we run into issues: >>> import pandas as pd
>>>
>>> tdi = pd.TimedeltaIndex([pd.NaT])
>>> td = pd.Timedelta('1 days')
>>>
>>> tdi - td # Should return TimedeltaIndex([pd.NaT])
...
OverflowError: Overflow in int64 addition This is because we are doing the checked add with the |
Additionally mask for that in the checking code? |
Hmmm...I suppose, though that will impact performance again 😢 . I can give it a shot anyways and see what happens. |
…dd (pandas-dev#14453) 1) Add checks to ensure that add overflow does not occur both in the positive or negative directions. 2) Add benchmarks to ensure that operations involving this checked add function are significantly impacted. (cherry picked from commit 83a380c)
Expands checked-add array addition introduced in pandas-devgh-14237 to include all other addition cases (i.e. TimedeltaIndex and TimeDelta). Follow-up to pandas-devgh-14453.
Expands checked-add array addition introduced in pandas-devgh-14237 to include all other addition cases (i.e. TimedeltaIndex and Timedelta). Follow-up to pandas-devgh-14453.
Expands checked-add array addition introduced in pandas-devgh-14237 to include all other addition cases (i.e. TimedeltaIndex and Timedelta). Follow-up to pandas-devgh-14453.
Expands checked-add array addition introduced in pandas-devgh-14237 to include all other addition cases (i.e. TimedeltaIndex and Timedelta). Follow-up to pandas-devgh-14453.
Expands checked-add array addition introduced in pandas-devgh-14237 to include all other addition cases (i.e. TimedeltaIndex and Timedelta). Follow-up to pandas-devgh-14453.
Expands checked-add array addition introduced in pandas-devgh-14237 to include all other addition cases (i.e. TimedeltaIndex and Timedelta). Follow-up to pandas-devgh-14453.
Expands checked-add array addition introduced in pandas-devgh-14237 to include all other addition cases (i.e. TimedeltaIndex and Timedelta). Follow-up to pandas-devgh-14453.
Expands checked-add array addition introduced in pandas-devgh-14237 to include all other addition cases (i.e. TimedeltaIndex and Timedelta). Follow-up to pandas-devgh-14453.
Expands checked-add array addition introduced in pandas-devgh-14237 to include all other addition cases (i.e. TimedeltaIndex and Timedelta). Follow-up to pandas-devgh-14453. In addition, move checked add function to core/algorithms.
Expands checked-add array addition introduced in pandas-devgh-14237 to include all other addition cases (i.e. TimedeltaIndex and Timedelta). Follow-up to pandas-devgh-14453. In addition, move checked add function to core/algorithms.
Expands checked-add array addition introduced in pandas-devgh-14237 to include all other addition cases (i.e. TimedeltaIndex and Timedelta). Follow-up to pandas-devgh-14453. In addition, move checked add function to core/algorithms.
Expands checked-add array addition introduced in pandas-devgh-14237 to include all other addition cases (i.e. TimedeltaIndex and Timedelta). Follow-up to pandas-devgh-14453. In addition, move checked add function to core/algorithms.
Port of #14324 after project name change.