Skip to content

DISC: remove Index and EA subclasses #43002

Open
@jbrockmendel

Description

@jbrockmendel

There has been discussion in eg #39133 about having EA-backed Indexes held in base-class Index objects, similar discussion regarding the new NumericIndex.

I do not like the idea of having some non-object dtypes return the base class Index, but would be on board for making all dtypes use the base class. i.e. only have Index and deprecate/remove all the subclasses. I'm envisioning roughly

  1. Implement relevant methods on the underlying EAs, eg DatetimeIndex.get_loc logic might live in DatetimeArray.get_loc.
  2. ??? for RangeIndex and MultiIndex, maybe make corresponding EAs?
  3. Methods currently available on subclasses but not Index would be accessed via accessor, e.g. dti.is_year_start becomes idx.foo.is_year_start

Related but independent, we could do the same with ExtensionArray subclasses. Instead of having authors implement methods on their EA subclass, they implement it on the ExtensionDtype subclass, which the EA object then dispatches to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExtensionArrayExtending pandas with custom dtypes or arrays.IdeasLong-Term Enhancement DiscussionsIndexRelated to the Index class or subclassesNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions