Skip to content

CLN: remove unnecessary _comparables #41638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pandas/core/indexes/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions pandas/core/indexes/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions pandas/core/indexes/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions pandas/core/indexes/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 0 additions & 4 deletions pandas/core/indexes/timedeltas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

# -------------------------------------------------------------------
Expand Down