-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
support Ellipsis (...) in pandas indexing #10956
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
Comments
Can you give some usecases? Because for direct getitem indexing on a dataframe, with a single item it already does index in the last dimension, so I could imagine it being useful in multi-indexing, eg with multiple levels of row indices, being able to easily select in the last level: |
The most compelling use case for me is with I agree this is not so common/useful with pandas itself but it would be nice for cross-compatibility with NumPy and xray. |
A workaround is to reset the index and reshuffle the order such that the relevant indices are first in the order |
Will #33616 enable ellipsis indexing also for
I know that this is a really cumbersome workaround, but perhaps it will help someone until the current v1.1 ETA. :) Where I need it: Inplace operations such as |
@JoElfner this is an open issue; if you want it fixed then a PR would do it |
Indexing like
x[..., 0]
is a convenient way to indexing the last dimension of an array with NumPy....
gets turned into anEllipsis
object, which NumPy expands to the appropriate number of full slice objects.It would be nice to support this in pandas, too. Currently, attempting to do this throws KeyError:
The text was updated successfully, but these errors were encountered: