Skip to content

More permissive Index typing #10067

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

Merged
merged 2 commits into from
Feb 24, 2025
Merged

Conversation

benbovy
Copy link
Member

@benbovy benbovy commented Feb 21, 2025

  • Index.isel: more permissive return type (any Xarray Index)

This allows an index to return a new index of another type, e.g., a
1-dimensional CoordinateTransformIndex to return a PandasIndex when a
new transform cannot be computed (selection at arbitrary locations).

  • Index.equals: more permissive other type (any Xarray Index)

Xarray alignment logic is such that Xarray indexes are always compared
with other indexes of the same type. However, this is not necessarily
the case for "meta" indexes (i.e., indexes encapsulating one or more
index objects that may have another type) that are dispatching equals
to their wrapped indexes.

More context and concrete examples in corteva/rioxarray#846 (comment) and corteva/rioxarray#846 (comment).

This allows an index to return a new index of another type, e.g., a
1-dimensional CoordinateTransformIndex to return a PandasIndex when a
new transform cannot be computed (selection at arbitrary locations).
Xarray alignment logic is such that Xarray indexes are always compared
with other indexes of the same type. However, this is not necessarily
the case for "meta" indexes (i.e., indexes encapsulating one or more
index objects that may have another type) that are dispatching `equals`
to their wrapped indexes.
@benbovy benbovy mentioned this pull request Feb 21, 2025
9 tasks
@benbovy benbovy merged commit df33a9a into pydata:main Feb 24, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy