diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py index be81ff1c3fa52..5f24eb0cfaad6 100644 --- a/pandas/core/indexes/datetimelike.py +++ b/pandas/core/indexes/datetimelike.py @@ -82,6 +82,7 @@ class DatetimeIndexOpsMixin(NDArrayBackedExtensionIndex): Common ops mixin to support a unified interface datetimelike Index. """ + _is_numeric_dtype = False _can_hold_strings = False _data: DatetimeArray | TimedeltaArray | PeriodArray freq: BaseOffset | None @@ -608,6 +609,8 @@ class DatetimeTimedeltaMixin(DatetimeIndexOpsMixin): """ _data: DatetimeArray | TimedeltaArray + _comparables = ["name", "freq"] + _attributes = ["name", "freq"] # Compat for frequency inference, see GH#23789 _is_monotonic_increasing = Index.is_monotonic_increasing diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index 5f930e7ee09cd..c4329393bb895 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -256,11 +256,6 @@ class DatetimeIndex(DatetimeTimedeltaMixin): _engine_type = libindex.DatetimeEngine _supports_partial_string_indexing = True - _comparables = ["name", "freqstr"] - _attributes = ["name", "freq"] - - _is_numeric_dtype = False - _data: DatetimeArray inferred_freq: str | None tz: tzinfo | None diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py index a682dad34c79d..894abb0fb1776 100644 --- a/pandas/core/indexes/interval.py +++ b/pandas/core/indexes/interval.py @@ -252,8 +252,6 @@ def func(self, other, sort=None): @inherit_names(["is_non_overlapping_monotonic", "closed"], IntervalArray, cache=True) class IntervalIndex(ExtensionIndex): _typ = "intervalindex" - _comparables = ["name"] - _attributes = ["name"] # annotate properties pinned via inherit_names closed: str diff --git a/pandas/core/indexes/period.py b/pandas/core/indexes/period.py index 266df655e326c..2600363bc28eb 100644 --- a/pandas/core/indexes/period.py +++ b/pandas/core/indexes/period.py @@ -158,9 +158,6 @@ class PeriodIndex(DatetimeIndexOpsMixin): _typ = "periodindex" _attributes = ["name"] - # define my properties & methods for delegation - _is_numeric_dtype = False - _data: PeriodArray freq: BaseOffset diff --git a/pandas/core/indexes/timedeltas.py b/pandas/core/indexes/timedeltas.py index ec97fa1e05851..cb83a0bccc748 100644 --- a/pandas/core/indexes/timedeltas.py +++ b/pandas/core/indexes/timedeltas.py @@ -112,10 +112,6 @@ class TimedeltaIndex(DatetimeTimedeltaMixin): _data_cls = TimedeltaArray _engine_type = libindex.TimedeltaEngine - _comparables = ["name", "freq"] - _attributes = ["name", "freq"] - _is_numeric_dtype = False - _data: TimedeltaArray # -------------------------------------------------------------------