Skip to content

ENH: Indexes with any numpy int/uint/float dtype #41272

Closed
@topper-123

Description

@topper-123

I've made a (draft) PR in #41153 that implements an index class for all the normal numpy numeric dtypes (int64/32/16/8, uint64/32/16/8 an dfloat65/32). There was some discussion in that PR how the public API for this should be, so I'm opening this issue for discussing that.

My plan is to get #41153 merged when its ready, possibly without any public-facing API changes. The public-facing changes would then come afterwards, and after there is an conclusion on how the API should be.

Summary of the options

As I see it the options for the API is:

Nr. Option Is backwards compat. complexity
1. Have a single, public NumericIndex class for all numeric index types Yes Easy
2. Have dtype-specific subclasses (Int8Index, Int16Index, Int32Index, etc), and those can still be backed by a single internal NumIndex Yes Easy
3. Use the existing, general-purpose Index class for these numeric numpy dtypes No Harder
4. Use the existing, numeric index classes for these numeric numpy dtypes, so e.g. Int64Index can take int32 etc. No Easy

Options 1. and 3. would mean that the existing Int64Index, UInt64Index and Float64Index would be deprecated and removed in pandas 2.0, because their functionality would bw covered by the other index classes.

Option 2. would increase the number of numeric index classes.

Options 4. would extend the functionality of the existing numeric index classes.

So there are quite a few possibilities. Hopefully we can come to a common conclusion.

@pandas-dev/pandas-core

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignConstructorsSeries/DataFrame/Index/pd.array ConstructorsEnhancementIndexRelated to the Index class or subclasses

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions