We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 03acfff commit a5cad77Copy full SHA for a5cad77
pandas/core/indexes/range.py
@@ -308,12 +308,12 @@ def has_duplicates(self):
308
309
@Appender(_index_shared_docs['get_loc'])
310
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)
+ if is_integer(key) and method is None and tolerance is None:
+ try:
+ return self._range.index(key)
+ except ValueError:
+ raise KeyError(key)
+ return super().get_loc(key, method=method, tolerance=tolerance)
317
318
def tolist(self):
319
return list(range(self._start, self._stop, self._step))
0 commit comments