DTI/TDI comparison ops with incompatible types · Issue #19804 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@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))])