pandas/core/indexes/timedeltas.py
def _td_index_cmp(opname, cls):
    """
    Wrap comparison operations to convert timedelta-like to timedelta64
    """
    nat_result = True if opname == '__ne__' else False

    def wrapper(self, other):
        msg = "cannot compare a {cls} with type {typ}"
        func = getattr(super(TimedeltaIndex, self), opname)
        if _is_convertible_to_td(other) or other is NaT:
            try:
                other = _to_m8(other)
            except ValueError:
                # failed to parse as timedelta
                raise TypeError(msg.format(cls=type(self).__name__,
                                           typ=type(other).__name__))
            result = func(other)
            if isna(other):
                result.fill(nat_result)

        elif not is_list_like(other):
            raise TypeError(msg.format(cls=type(self).__name__,
                                       typ=type(other).__name__))
        else:
            other = TimedeltaIndex(other).values
            result = func(other)
            result = com._values_from_object(result)

            o_mask = np.array(isna(other))
            if o_mask.any():
                result[o_mask] = nat_result

        if self.hasnans:
            result[self._isnan] = nat_result

        # support of bool dtype indexers
        if is_bool_dtype(result):
            return result
        return Index(result)

    return compat.set_function_name(wrapper, opname, cls)

    Wrap comparison operations to convert timedelta-like to timedelta64
    
Wrap comparison operations to convert timedelta-like to timedelta64
Wrap comparison operations to convert timedelta - like to timedelta64
def _td_index_cmp(opname, cls):
    nat_result = True if opname == '__ne__' else False
    def wrapper(self, other):
        msg = "cannot compare a {cls} with type {typ}"
        func = getattr(super(TimedeltaIndex, self), opname)
        if _is_convertible_to_td(other) or other is NaT:
            try:
                other = _to_m8(other)
            except ValueError:
                raise TypeError(msg.format(cls=type(self).__name__,
                                           typ=type(other).__name__))
            result = func(other)
            if isna(other):
                result.fill(nat_result)
        elif not is_list_like(other):
            raise TypeError(msg.format(cls=type(self).__name__,
                                       typ=type(other).__name__))
        else:
            other = TimedeltaIndex(other).values
            result = func(other)
            result = com._values_from_object(result)
            o_mask = np.array(isna(other))
            if o_mask.any():
                result[o_mask] = nat_result
        if self.hasnans:
            result[self._isnan] = nat_result
        if is_bool_dtype(result):
            return result
        return Index(result)
    return compat.set_function_name(wrapper, opname, cls)
def _td_index_cmp ( opname , cls ) : nat_result = True if opname == '__ne__' else False def wrapper ( self , other ) : msg = "cannot compare a {cls} with type {typ}" func = getattr ( super ( TimedeltaIndex , self ) , opname ) if _is_convertible_to_td ( other ) or other is NaT : try : other = _to_m8 ( other ) except ValueError : raise TypeError ( msg . format ( cls = type ( self ) . __name__ , typ = type ( other ) . __name__ ) ) result = func ( other ) if isna ( other ) : result . fill ( nat_result ) elif not is_list_like ( other ) : raise TypeError ( msg . format ( cls = type ( self ) . __name__ , typ = type ( other ) . __name__ ) ) else : other = TimedeltaIndex ( other ) . values result = func ( other ) result = com . _values_from_object ( result ) o_mask = np . array ( isna ( other ) ) if o_mask . any ( ) : result [ o_mask ] = nat_result if self . hasnans : result [ self . _isnan ] = nat_result if is_bool_dtype ( result ) : return result return Index ( result ) return compat . set_function_name ( wrapper , opname , cls )
Wrap comparison operations to convert timedelta-like to timedelta64
Wrap comparison operations to convert timedelta - like to timedelta64
"""
    Wrap comparison operations to convert timedelta-like to timedelta64
    """ # failed to parse as timedelta # support of bool dtype indexers
opname
cls