-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Should indexing be possible on 1D coords, even if not dims? #934
Comments
I tried to awake interest for this kind of indexing on the mailinglist without success so far: |
In your case: arr.isel(space=(arr.space2=='A')) |
Yes, this would be nice to support automatically. Doing indexing requiring constructing a hash table (in the form of a The only material difference between So there are a few approaches we could take here:
|
That's very clear @shoyer. I know you've discussed in the past whether indexes are really that different from arrays (they are treated very different in pandas, for example). To reiterate the above, the only real difference is one is designed for lookups (and so uses a hash table), and the other is designed for data access (and so mutation is easier). We try to never use mutation, but our data is not that big, so making a copy is generally OK. But that's probably not the main use case. Another option (potentially 1b in your list) is to slice the array rather than select from an index - i.e. sugar over @fmaussion 's solution above. Not as fast to do multiple times, but simple and probably as fast to do a single time. |
In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity |
This will be part of the explicit indexes refactor (#1603) |
Now try to select on the space2 coord:
Is there an easier way to do this? I couldn't think of anything...
CC @justinkuosixty
The text was updated successfully, but these errors were encountered: