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

Method _get_indexer

pandas/core/indexes/interval.py:824–851  ·  view source on GitHub ↗
(
        self,
        target: Index,
        method: str | None = None,
        limit: int | None = None,
        tolerance: Any | None = None,
    )

Source from the content-addressed store, hash-verified

822 return res
823
824 def _get_indexer(
825 self,
826 target: Index,
827 method: str | None = None,
828 limit: int | None = None,
829 tolerance: Any | None = None,
830 ) -> npt.NDArray[np.intp]:
831 if isinstance(target, IntervalIndex):
832 # We only get here with not self.is_overlapping
833 # -> at most one match per interval in target
834 # want exact matches -> need both left/right to match, so defer to
835 # left/right get_indexer, compare elementwise, equality -> match
836 if self.left.is_unique and self.right.is_unique:
837 indexer = self._get_indexer_unique_sides(target)
838 else:
839 indexer = self._get_indexer_pointwise(target)[0]
840
841 elif not (is_object_dtype(target.dtype) or is_string_dtype(target.dtype)):
842 # homogeneous scalar index: use IntervalTree
843 # we should always have self._should_partial_index(target) here
844 target = self._maybe_convert_i8(target)
845 indexer = self._engine.get_indexer(target.values)
846 else:
847 # heterogeneous scalar index: defer elementwise to get_loc
848 # we should always have self._should_partial_index(target) here
849 return self._get_indexer_pointwise(target)[0]
850
851 return ensure_platform_int(indexer)
852
853 def get_indexer_non_unique(
854 self, target: Index

Callers

nothing calls this directly

Calls 6

_maybe_convert_i8Method · 0.95
is_object_dtypeFunction · 0.90
is_string_dtypeFunction · 0.90
get_indexerMethod · 0.45

Tested by

no test coverage detected