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

Improve performance when selecting rows and columns #53014

Merged
merged 4 commits into from
May 4, 2023

Conversation

phofl
Copy link
Member

@phofl phofl commented Apr 30, 2023

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

@@ -933,7 +933,8 @@ def _getitem_tuple_same_dim(self, tup: tuple):
This is only called after a failed call to _getitem_lowerdim.
"""
retval = self.obj
for i, key in enumerate(tup):
for i, key in enumerate(reversed(tup)):
i = self.ndim - i - 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment about why doing it this way, otherwise future-me might try to “simplify” it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can also put this right before retval = ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment, prefer keeping it here. We might miss this if we use i before this at some point

@mroeschke mroeschke added Indexing Related to indexing on series/frames, not to indexes themselves Performance Memory or execution speed performance labels May 1, 2023
phofl and others added 3 commits May 2, 2023 23:10
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
@mroeschke mroeschke added this to the 2.1 milestone May 4, 2023
@mroeschke mroeschke merged commit 4f4184d into pandas-dev:main May 4, 2023
29 checks passed
@mroeschke
Copy link
Member

Thanks @phofl

@phofl phofl deleted the perf_indexing branch May 4, 2023 18:50
topper-123 pushed a commit to topper-123/pandas that referenced this pull request May 7, 2023
* Improve performance when selecting rows and columns

* Update doc/source/whatsnew/v2.1.0.rst

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>

* Update indexing.py

* Update v2.1.0.rst

---------

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
topper-123 pushed a commit to topper-123/pandas that referenced this pull request May 7, 2023
* Improve performance when selecting rows and columns

* Update doc/source/whatsnew/v2.1.0.rst

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>

* Update indexing.py

* Update v2.1.0.rst

---------

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
topper-123 pushed a commit to topper-123/pandas that referenced this pull request May 9, 2023
* Improve performance when selecting rows and columns

* Update doc/source/whatsnew/v2.1.0.rst

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>

* Update indexing.py

* Update v2.1.0.rst

---------

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Rylie-W pushed a commit to Rylie-W/pandas that referenced this pull request May 19, 2023
* Improve performance when selecting rows and columns

* Update doc/source/whatsnew/v2.1.0.rst

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>

* Update indexing.py

* Update v2.1.0.rst

---------

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
topper-123 pushed a commit to topper-123/pandas that referenced this pull request May 27, 2023
* Improve performance when selecting rows and columns

* Update doc/source/whatsnew/v2.1.0.rst

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>

* Update indexing.py

* Update v2.1.0.rst

---------

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
topper-123 pushed a commit to topper-123/pandas that referenced this pull request May 27, 2023
* Improve performance when selecting rows and columns

* Update doc/source/whatsnew/v2.1.0.rst

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>

* Update indexing.py

* Update v2.1.0.rst

---------

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Daquisu pushed a commit to Daquisu/pandas that referenced this pull request Jul 8, 2023
* Improve performance when selecting rows and columns

* Update doc/source/whatsnew/v2.1.0.rst

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>

* Update indexing.py

* Update v2.1.0.rst

---------

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

None yet

3 participants