Skip to content

DTI/TDI comparison ops with incompatible types #19804

Closed
@jbrockmendel

Description

@jbrockmendel

Timestamp and Timedelta comparisons against non-Timestamp/Timedelta-like others return False for __eq__, True for __ne__ and raise TypeError for inequalities. DatetimeIndex follows this convention in some cases, but there are paths that will end up raising instead of returning True/False. TimedeltaIndex doesn't follow this convention at all.

Is the current hodge-podge intentional? If not I can put together a PR to ensure that index.__cmp__(other) == np.array([index[n].__cmp__(other) for n in range(len(index))])

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDatetimeDatetime data dtypeNumeric OperationsArithmetic, Comparison, and Logical operationsTimedeltaTimedelta data type

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions