Skip to content

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

Merged
merged 2 commits into from
Sep 1, 2017
Merged

Tslib unused #17402

merged 2 commits into from
Sep 1, 2017

Conversation

jbrockmendel
Copy link
Member

@jbrockmendel jbrockmendel commented Aug 31, 2017

along with one repeated string and a case in _Timedelta.__richcmp__ that is not reachable.

@codecov
Copy link

codecov bot commented Aug 31, 2017

Codecov Report

Merging #17402 into master will decrease coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 88.77% <ø> (-0.03%) ⬇️
#single 40.26% <ø> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/plotting/_converter.py 63.23% <0%> (-1.82%) ⬇️
pandas/core/frame.py 97.72% <0%> (-0.1%) ⬇️

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 062f6f1...3ebd4ab. Read the comment docs.

@sinhrks sinhrks added Clean Internals Related to non-user accessible pandas implementation Timedelta Timedelta data type labels Aug 31, 2017
@jbrockmendel
Copy link
Member Author

Closes #17379

@@ -2622,8 +2622,6 @@ cdef class _Timedelta(timedelta):
int ndim

if isinstance(other, _Timedelta):
if isinstance(other, _NaT):
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 you think this can be removed? are the NaT comparisons handled higher up (IOW they never hit this)? (I don't remember)

Copy link
Member Author

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.

Copy link
Contributor

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

@jreback jreback added this to the 0.21.0 milestone Sep 1, 2017
@jreback jreback merged commit 8351f86 into pandas-dev:master Sep 1, 2017
@jbrockmendel jbrockmendel deleted the tslib_unused branch September 1, 2017 17:20
jowens pushed a commit to jowens/pandas that referenced this pull request Sep 20, 2017
alanbato pushed a commit to alanbato/pandas that referenced this pull request Nov 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Internals Related to non-user accessible pandas implementation Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unreached/Unreachable(?) paths in tslib
3 participants