pandas/core/indexes/timedeltas.py
def intersection(self, other):
        """
        Specialized intersection for TimedeltaIndex objects. May be much faster
        than Index.intersection

        Parameters
        ----------
        other : TimedeltaIndex or array-like

        Returns
        -------
        y : Index or TimedeltaIndex
        """
        self._assert_can_do_setop(other)
        if not isinstance(other, TimedeltaIndex):
            try:
                other = TimedeltaIndex(other)
            except (TypeError, ValueError):
                pass
            result = Index.intersection(self, other)
            return result

        if len(self) == 0:
            return self
        if len(other) == 0:
            return other
        # to make our life easier, "sort" the two ranges
        if self[0] <= other[0]:
            left, right = self, other
        else:
            left, right = other, self

        end = min(left[-1], right[-1])
        start = right[0]

        if end < start:
            return type(self)(data=[])
        else:
            lslice = slice(*left.slice_locs(start, end))
            left_chunk = left.values[lslice]
            return self._shallow_copy(left_chunk)

        Specialized intersection for TimedeltaIndex objects. May be much faster
        than Index.intersection

        Parameters
        ----------
        other : TimedeltaIndex or array-like

        Returns
        -------
        y : Index or TimedeltaIndex
        
Specialized intersection for TimedeltaIndex objects. May be much faster
than Index.intersection

Parameters

other : TimedeltaIndex or array-like

Returns

y : Index or TimedeltaIndex
Specialized intersection for TimedeltaIndex objects . May be much faster than Index . intersection Parameters other : TimedeltaIndex or array - like Returns y : Index or TimedeltaIndex
def intersection(self, other):
        self._assert_can_do_setop(other)
        if not isinstance(other, TimedeltaIndex):
            try:
                other = TimedeltaIndex(other)
            except (TypeError, ValueError):
                pass
            result = Index.intersection(self, other)
            return result
        if len(self) == 0:
            return self
        if len(other) == 0:
            return other
        if self[0] <= other[0]:
            left, right = self, other
        else:
            left, right = other, self
        end = min(left[-1], right[-1])
        start = right[0]
        if end < start:
            return type(self)(data=[])
        else:
            lslice = slice(*left.slice_locs(start, end))
            left_chunk = left.values[lslice]
            return self._shallow_copy(left_chunk)
def intersection ( self , other ) : self . _assert_can_do_setop ( other ) if not isinstance ( other , TimedeltaIndex ) : try : other = TimedeltaIndex ( other ) except ( TypeError , ValueError ) : pass result = Index . intersection ( self , other ) return result if len ( self ) == 0 : return self if len ( other ) == 0 : return other if self [ 0 ] <= other [ 0 ] : left , right = self , other else : left , right = other , self end = min ( left [ - 1 ] , right [ - 1 ] ) start = right [ 0 ] if end < start : return type ( self ) ( data = [ ] ) else : lslice = slice ( * left . slice_locs ( start , end ) ) left_chunk = left . values [ lslice ] return self . _shallow_copy ( left_chunk )
Specialized intersection for TimedeltaIndex objects.
Specialized intersection for TimedeltaIndex objects .
"""
        Specialized intersection for TimedeltaIndex objects. May be much faster
        than Index.intersection

        Parameters
        ----------
        other : TimedeltaIndex or array-like

        Returns
        -------
        y : Index or TimedeltaIndex
        """ # to make our life easier, "sort" the two ranges
self
other