def intersection(self, other):
        self._assert_can_do_setop(other)
        other = _ensure_index(other)

        if self.equals(other):
            return self

        if not com.is_dtype_equal(self.dtype, other.dtype):
            this = self.astype('O')
            other = other.astype('O')
            return this.intersection(other)

        if self.is_monotonic and other.is_monotonic:
            try:
                result = self._inner_indexer(self.values, other._values)[0]
                return self._wrap_union_result(other, result)
            except TypeError:
                pass

        try:
            indexer = Index(self.values).get_indexer(other._values)
            indexer = indexer.take((indexer != -1).nonzero()[0])
        except:
            # duplicates
            indexer = Index(self.values).get_indexer_non_unique(
                other._values)[0].unique()
            indexer = indexer[indexer != -1]

        taken = self.take(indexer)
        if self.name != other.name:
            taken.name = None
        return taken
Get the portion of the input that has been tokenized.
dataset/ETHPy150Open pydata/pandas/pandas/indexes/base.py/Index.intersection--crossover with--dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/words/xish/xpathparser.py/Scanner.get_input_scanned