MCPcopy
hub / github.com/pandas-dev/pandas / get_loc

Method get_loc

pandas/core/indexes/timedeltas.py:232–247  ·  view source on GitHub ↗

Get integer location for requested label Returns ------- loc : int, slice, or ndarray[int]

(self, key)

Source from the content-addressed store, hash-verified

230 # Indexing Methods
231
232 def get_loc(self, key):
233 """
234 Get integer location for requested label
235
236 Returns
237 -------
238 loc : int, slice, or ndarray[int]
239 """
240 self._check_indexing_error(key)
241
242 try:
243 key = self._data._validate_scalar(key, unbox=False)
244 except TypeError as err:
245 raise KeyError(key) from err
246
247 return Index.get_loc(self, key)
248
249 # error: Return type "tuple[Timedelta | NaTType, Resolution]" of
250 # "_parse_with_reso" incompatible with return type

Callers 1

test_get_loc_natMethod · 0.95

Calls 2

_check_indexing_errorMethod · 0.45
_validate_scalarMethod · 0.45

Tested by 1

test_get_loc_natMethod · 0.76