Skip to content

Generic type for Indexes #340

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

Closed
jonyscathe opened this issue Sep 29, 2022 · 6 comments · Fixed by #760
Closed

Generic type for Indexes #340

jonyscathe opened this issue Sep 29, 2022 · 6 comments · Fixed by #760
Labels
Generic Index Issues where a Generic Index would help Index Related to the Index class or subclasses

Comments

@jonyscathe
Copy link

Hi,

We have just moved over to pandas-stubs from data-science-types.
Overall it is vastly superior so I am enjoying being able to remove countless type-ignores that we needed due to the incompleteness of the data-science-types stubs.

However, one thing that is not ideal is that we did have a lot of Indexes with types specified, i.e., Index[int] as data-science-types have their Index class as Generic: class Index(Generic[_T]):
Now with pandas-stubs we are having to remove those index types which isn't the end of the world, but they are nice to have.
If it isn't too hard to get that working, I would definitely appreciate having generic types for Indexes

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Sep 29, 2022

This did exist in the Microsoft predecessor of these stubs about 10 months ago, but we had to remove it because of various mypy failures.

Certainly open to adding it back in and having someone do a PR for that!

@Dr-Irv Dr-Irv added the Index Related to the Index class or subclasses label Sep 29, 2022
@gandhis1
Copy link
Contributor

gandhis1 commented Oct 5, 2022

IMO this is arguably one of the most important features that could be added to this module...as I continue to annotate my own code bases and discover gaps in the stubs, one of the recurring themes is the the propagation of Any types where we do have the ability to know better - especially relating to Series and Index (and DataFrame as well, but that also suffers from the lack of types on individual columns, which is probably a substantially more complex problem to solve).

@Dr-Irv Dr-Irv added the Generic Index Issues where a Generic Index would help label Jan 9, 2023
@twoertwein
Copy link
Member

@jonyscathe #760 will need more time and work but it would address this issue, or?

@twoertwein
Copy link
Member

I will create a follow-up PR for truediv

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Aug 14, 2023

I will create a follow-up PR for truediv

I was considering doing a release with the new generic index. Should I wait for that PR?

@twoertwein
Copy link
Member

I might have a PR today but I think you can go ahead - truediv/floordif are quite tricky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Generic Index Issues where a Generic Index would help Index Related to the Index class or subclasses
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants