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

PERF: Index.__getitem__ should not need to do dtype inference #31903

Closed
jorisvandenbossche opened this issue Feb 11, 2020 · 3 comments
Closed
Labels
Indexing Related to indexing on series/frames, not to indexes themselves Performance Memory or execution speed performance

Comments

@jorisvandenbossche
Copy link
Member

Currently, the __getitem__ call in a snippet like

idx = pd.Index([1, 2, 3, 4])
idx[np.array([0, 3])]

does type inference when creating the new Index object (using _shallow_copy_with_infer), while I think we can always know for sure the result will be another Int64Index (for the above example) ?

@jorisvandenbossche jorisvandenbossche added Indexing Related to indexing on series/frames, not to indexes themselves Performance Memory or execution speed performance labels Feb 11, 2020
@jorisvandenbossche jorisvandenbossche added this to the Contributions Welcome milestone Feb 11, 2020
@jbrockmendel
Copy link
Member

Index.__getitem__ no longer uses _shallow_copy_with_infer. Are there other optimizations you had in mind?

@jbrockmendel
Copy link
Member

Closing as I'm pretty sure this no longer does type inference. Feel free to reopen if ive got this wrong.

@jorisvandenbossche jorisvandenbossche removed this from the Contributions Welcome milestone Jun 10, 2020
@jorisvandenbossche
Copy link
Member Author

Yep, that's correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves Performance Memory or execution speed performance
Projects
None yet
Development

No branches or pull requests

2 participants