-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Tslib unused #17402
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
Tslib unused #17402
Conversation
Codecov Report
@@ Coverage Diff @@
## master #17402 +/- ##
==========================================
- Coverage 91.03% 90.99% -0.05%
==========================================
Files 163 163
Lines 49580 49580
==========================================
- Hits 45137 45116 -21
- Misses 4443 4464 +21
Continue to review full report at Codecov.
|
Closes #17379 |
@@ -2622,8 +2622,6 @@ cdef class _Timedelta(timedelta): | |||
int ndim | |||
|
|||
if isinstance(other, _Timedelta): | |||
if isinstance(other, _NaT): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you think this can be removed? are the NaT comparisons handled higher up (IOW they never hit this)? (I don't remember)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See discussion in #17379. TLDR: _NaT
does not subclass _Timedelta
, so something very weird would have to be going on for this condition to be satisfied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In [1]: pd.Timedelta('1 day') > pd.NaT
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-9550edbbc777> in <module>()
----> 1 pd.Timedelta('1 day') > pd.NaT
/Users/jreback/pandas/pandas/_libs/tslib.pyx in pandas._libs.tslib._Timedelta.__richcmp__ (pandas/_libs/tslib.c:47402)()
2653 elif op == Py_NE:
2654 return True
-> 2655 raise TypeError('Cannot compare type %r with type %r' %
2656 (type(self).__name__, type(other).__name__))
2657
TypeError: Cannot compare type 'Timedelta' with type 'NaTType'
In [2]: pd.Timedelta('1 day') == pd.NaT
Out[2]: False
right so this is ok
along with one repeated string and a case in
_Timedelta.__richcmp__
that is not reachable.git diff upstream/master -u -- "*.py" | flake8 --diff