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

Method __contains__

pandas/core/indexes/interval.py:457–480  ·  view source on GitHub ↗

return a boolean if this key is IN the index We *only* accept an Interval Parameters ---------- key : Interval Returns ------- bool

(self, key: Any)

Source from the content-addressed store, hash-verified

455 return IntervalTree(left, right, closed=self.closed)
456
457 def __contains__(self, key: Any) -> bool:
458 """
459 return a boolean if this key is IN the index
460 We *only* accept an Interval
461
462 Parameters
463 ----------
464 key : Interval
465
466 Returns
467 -------
468 bool
469 """
470 hash(key)
471 if not isinstance(key, Interval):
472 if is_valid_na_for_dtype(key, self.dtype):
473 return self.hasnans
474 return False
475
476 try:
477 self.get_loc(key)
478 return True
479 except KeyError:
480 return False
481
482 def _getitem_slice(self, slobj: slice) -> IntervalIndex:
483 """

Callers

nothing calls this directly

Calls 2

get_locMethod · 0.95
is_valid_na_for_dtypeFunction · 0.90

Tested by

no test coverage detected