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

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

Closed
Dr-Irv opened this issue Jan 27, 2023 · 13 comments · Fixed by #51139
Closed

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

Dr-Irv opened this issue Jan 27, 2023 · 13 comments · Fixed by #51139

Comments

@Dr-Irv
Copy link
Contributor

Dr-Irv commented Jan 27, 2023

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

@phofl
Copy link
Member

phofl commented Jan 27, 2023

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

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Jan 27, 2023

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
Copy link
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
Copy link
Contributor Author

Dr-Irv commented Jan 30, 2023

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
Copy link
Contributor

👍

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Feb 6, 2023

@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
Copy link
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
Copy link
Contributor Author

Dr-Irv commented Feb 6, 2023

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
Copy link
Member

phofl commented Feb 6, 2023

Since NumericIndex was never public I‘d say no.

@topper-123
Copy link
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
Copy link
Contributor Author

Dr-Irv commented Feb 6, 2023

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
Copy link
Member

We can still update the docs for 1.5.x

@jorisvandenbossche
Copy link
Member

-> #51238

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants