Skip to content

Include NumericIndex at top level and document it for version 2.0 #51020

Closed
@Dr-Irv

Description

@Dr-Irv
Contributor

With the removal of IntegerIndex, FloatIndex, etc., and now promoting its replacement NumericIndex, there are a couple of things to consider:

  1. I think that NumericIndex should appear in pandas.__init__.py like the other Index types so that pd.NumericIndex works.
  2. We should document it, since we refer to it in the documentation. It appears as a result in examples, and we refer to it, e.g. here:

https://pandas.pydata.org/docs/dev/reference/api/pandas.Index.html?highlight=numericindex

@topper-123 may be tracking this based on comments in #50908

Activity

phofl

phofl commented on Jan 27, 2023

@phofl
Member

I might be mistaken here, but I think the goal is to remove NumericIndex as well and to include everything in Index

Dr-Irv

Dr-Irv commented on Jan 27, 2023

@Dr-Irv
ContributorAuthor

I might be mistaken here, but I think the goal is to remove NumericIndex as well and to include everything in Index

OK. I'm just basing this on what our tests in pandas-stubs picked up when we run our tests with pytest against the nightly builds. Had to remove references that we had to IntegerIndex and changed them to NumericIndex. If we are getting rid of that too, then I'll make the change in the tests there when the nightly test fails.

topper-123

topper-123 commented on Jan 28, 2023

@topper-123
Contributor

Hi, yes, the goal is to remove NumericIndex and have the numpy dtypes that were previously utilized in NumericIndex, included directly in Index instead. I'm hoping to archieve it over this weekend, so I don't know if it will be more time efficient for you to wait doing the corrections now or maybe wait until NumericIndexhas been removed.

I have not given any attention so far to pandas-stubs in this process, sorry. I could check if my changes fit well into that package or will you take care of that?

Dr-Irv

Dr-Irv commented on Jan 30, 2023

@Dr-Irv
ContributorAuthor

I have not given any attention so far to pandas-stubs in this process, sorry. I could check if my changes fit well into that package or will you take care of that?

We'll take care of that. Once you close this issue, I'll know you've made the changes and can modify the stubs and associated tests.

topper-123

topper-123 commented on Jan 30, 2023

@topper-123
Contributor

👍

Dr-Irv

Dr-Irv commented on Feb 6, 2023

@Dr-Irv
ContributorAuthor

@topper-123 I know you have done the work to remove NumericIndex, but our 1.5.x docs here say that NumericIndex will remain for 2.0: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Int64Index.html

Deprecated since version 1.4.0: In pandas v2.0 Int64Index will be removed and NumericIndex used instead. Int64Index will remain fully functional for the duration of pandas 1.x.

topper-123

topper-123 commented on Feb 6, 2023

@topper-123
Contributor

Hi @Dr-Irv. The original plan was actually to add NumericIndex to the top level namespace, but that was changed later to have all the numeric index functionality merged into the base Index. So that doc string was wrong/should have been updated, when the plans changed...

The changes have been made now, and NumericIndex has been removed completely now from the code base.

Dr-Irv

Dr-Irv commented on Feb 6, 2023

@Dr-Irv
ContributorAuthor

Hi @Dr-Irv. The original plan was actually to add NumericIndex to the top level namespace, but that was changed later to have all the numeric index functionality merged into the base Index. So that doc string was wrong/should have been updated, when the plans changed...

So the question is whether our failure to update that doc string means we are violating our own principles with respect to the deprecation policy.

phofl

phofl commented on Feb 6, 2023

@phofl
Member

Since NumericIndex was never public I‘d say no.

topper-123

topper-123 commented on Feb 6, 2023

@topper-123
Contributor

Yeah, In the 1.4 whatsnew we said:

Int64Index, UInt64Index and Float64Index have been deprecated in favor of the base Index class and will be removed in Pandas 2.0 (GH43028).

and the deprecation message was:

>>> idx = pd.Int64Index([])
FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.

In any case, that doc string should have been updated as well...

Dr-Irv

Dr-Irv commented on Feb 6, 2023

@Dr-Irv
ContributorAuthor

and the deprecation message was:

>>> idx = pd.Int64Index([])
FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.

I think that gives us enough coverage in case someone complains...

jorisvandenbossche

jorisvandenbossche commented on Feb 8, 2023

@jorisvandenbossche
Member

We can still update the docs for 1.5.x

jorisvandenbossche

jorisvandenbossche commented on Feb 8, 2023

@jorisvandenbossche
Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @jorisvandenbossche@Dr-Irv@topper-123@phofl

      Issue actions

        Include NumericIndex at top level and document it for version 2.0 · Issue #51020 · pandas-dev/pandas