

def get_indexer(self, target, method=None, limit=None, tolerance=None):
    "\n        Compute indexer and mask for new index given the current index. The\n        indexer should be then used as an input to ndarray.take to align the\n        current data to the new index.\n\n        Parameters\n        ----------\n        target : Index\n        method : {None, 'pad'/'ffill', 'backfill'/'bfill', 'nearest'}, optional\n            * default: exact matches only.\n            * pad / ffill: find the PREVIOUS index value if no exact match.\n            * backfill / bfill: use NEXT index value if no exact match\n            * nearest: use the NEAREST index value if no exact match. Tied\n              distances are broken by preferring the larger index value.\n        limit : int, optional\n            Maximum number of consecutive labels in ``target`` to match for\n            inexact matches.\n        tolerance : optional\n            Maximum distance between original and new labels for inexact\n            matches. The values of the index at the matching locations most\n            satisfy the equation ``abs(index[indexer] - target) <= tolerance``.\n\n            .. versionadded:: 0.17.0\n\n        Examples\n        --------\n        >>> indexer = index.get_indexer(new_index)\n        >>> new_values = cur_values.take(indexer)\n\n        Returns\n        -------\n        indexer : ndarray of int\n            Integers from 0 to n - 1 indicating that the index at these\n            positions matches the corresponding target values. Missing values\n            in the target are marked by -1.\n        "
    method = missing.clean_reindex_fill_method(method)
    target = _ensure_index(target)
    if (tolerance is not None):
        tolerance = self._convert_tolerance(tolerance)
    (pself, ptarget) = self._possibly_promote(target)
    if ((pself is not self) or (ptarget is not target)):
        return pself.get_indexer(ptarget, method=method, limit=limit, tolerance=tolerance)
    if (not com.is_dtype_equal(self.dtype, target.dtype)):
        this = self.astype(object)
        target = target.astype(object)
        return this.get_indexer(target, method=method, limit=limit, tolerance=tolerance)
    if (not self.is_unique):
        raise InvalidIndexError('Reindexing only valid with uniquely valued Index objects')
    if ((method == 'pad') or (method == 'backfill')):
        indexer = self._get_fill_indexer(target, method, limit, tolerance)
    elif (indexer == 'nearest'):
        indexer = self._get_nearest_indexer(target, limit, tolerance)
    else:
        if (tolerance is not None):
            raise ValueError('tolerance argument only valid if doing pad, backfill or nearest reindexing')
        if (limit is not None):
            raise ValueError('limit argument only valid if doing pad, backfill or nearest reindexing')
        indexer = self._engine.get_indexer(target._values)
    return com._ensure_platform_int(indexer)

dataset/ETHPy150Open pydata/pandas/pandas/indexes/base.py Index.get_indexer/VarMisuse@225/818 `method`->`indexer`