-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Cast a key to NaT before get loc from Index #13687
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
Conversation
@@ -697,6 +697,10 @@ def get_loc(self, key, method=None, tolerance=None): | |||
------- | |||
loc : int | |||
""" | |||
|
|||
if tslib.checknull_with_nat(key): |
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.
just use pd.isnull
Current coverage is 84.38%@@ master #13687 diff @@
==========================================
Files 142 142
Lines 51223 51225 +2
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43224 43226 +2
Misses 7999 7999
Partials 0 0
|
td = to_timedelta([pd.NaT]) | ||
for v in [pd.NaT, None, float('nan'), np.nan]: | ||
self.assertTrue((v in td)) | ||
|
||
def test_construction(self): |
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.
can u also add tests for get_loc
like:
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.
I added!
I think related issues should be fixed by changing
|
I will challenge |
ok, pls add a whatsnew entry, otherwise lgtm. |
Updated a whatsnew entry! |
pd.NaT, None, float('nan') and np.nan are converted NaT in TestTimedeltas. So we should convert keys if keys are these value. Fix pandas-dev#13603
thanks! |
😄 |
git diff upstream/master | flake8 --diff
pd.NaT, None, float('nan') and np.nan are
converted NaT in TestTimedeltas.
So we should convert keys if keys are these value.
Fix #13603