File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ from pandas._libs.missing import checknull
2727cdef int64_t NPY_NAT = util.get_nat()
2828
2929
30- cdef inline bint is_definitely_invalid_key(object val):
30+ cpdef inline bint is_definitely_invalid_key(object val):
3131 if isinstance (val, tuple ):
3232 try :
3333 hash (val)
Original file line number Diff line number Diff line change @@ -308,12 +308,13 @@ def has_duplicates(self):
308308
309309 @Appender (_index_shared_docs ['get_loc' ])
310310 def get_loc (self , key , method = None , tolerance = None ):
311- if method is None and tolerance is None :
312- try :
313- return self ._range .index (key )
314- except ValueError :
315- raise KeyError (key )
316- return super ().__get_loc (key , method = method , tolerance = tolerance )
311+ if not libindex .is_definitely_invalid_key (key ):
312+ if method is None and tolerance is None :
313+ try :
314+ return self ._range .index (key )
315+ except ValueError :
316+ raise KeyError (key )
317+ return super ().get_loc (key , method = method , tolerance = tolerance )
317318
318319 def tolist (self ):
319320 return list (range (self ._start , self ._stop , self ._step ))
You can’t perform that action at this time.
0 commit comments