Skip to content
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

Add interface for defining an ExtensionIndex #22861

Closed
TomAugspurger opened this issue Sep 27, 2018 · 4 comments · Fixed by #43930
Closed

Add interface for defining an ExtensionIndex #22861

TomAugspurger opened this issue Sep 27, 2018 · 4 comments · Fixed by #43930
Labels
Enhancement ExtensionArray Extending pandas with custom dtypes or arrays. Index Related to the Index class or subclasses
Milestone

Comments

@TomAugspurger
Copy link
Contributor

These occur naturally with .groupby(extensionarray) and Seres[extensionarray].value_counts. We should define a public API so that we don't have to convert to object in these cases.

You'd likely end up with an Index with a non-object dtype.


more radically this kind of removes the need for all our Index subclasses, aside from MultiIndex. But we can think about that separately from the interface.

I don't think this is blocking for 1.0, but it may not be too much effort.

@TomAugspurger TomAugspurger added Indexing Related to indexing on series/frames, not to indexes themselves API Design ExtensionArray Extending pandas with custom dtypes or arrays. labels Sep 27, 2018
@TomAugspurger TomAugspurger added this to the Contributions Welcome milestone Sep 27, 2018
@jorisvandenbossche
Copy link
Member

Given that we already have / will have several example (CategoricalIndex, IntervalIndex, DatetimeIndex, ...) that actually do this, I think it shouldn't be too hard to distil some common things out of those to have an ExtensionIndex?

(maybe could even give some base class for them)

It's true that our "index as container" model indeed doesn't necessarily need the specific classes (similar as Series does not have several classes). But I think that boat has sailed for pandas itself. The main difference is that on Index subclasses, we allow several type-specific methods, something I personally actually like.

@toobaz toobaz added Index Related to the Index class or subclasses and removed Indexing Related to indexing on series/frames, not to indexes themselves labels Jun 29, 2019
@TomAugspurger
Copy link
Contributor Author

IMO this would be a good roadmap item once #27478 is in.

@Detry322
Copy link

@jreback if I took a stab at this in the near future (a week or so) is there any hope of it being included in 1.0?

@jreback
Copy link
Contributor

jreback commented Nov 13, 2019

yes it’s possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ExtensionArray Extending pandas with custom dtypes or arrays. Index Related to the Index class or subclasses
Projects
None yet
6 participants