Skip to content

Conversation

@ianhi
Copy link
Contributor

@ianhi ianhi commented Dec 17, 2025

Closes: #9703

allows .sel to automatically create a PandasIndex object for if one is not present.

import xarray as xr
ds = xr.Dataset(
    {"data":('time', [0,1,2,3])},
    coords={"time":[.1, .2, .3, .4], 'time_metadata':('time', [10,15,20,25])}
)
ds
# both these work and are equivalent
ds.sel(time=.2)
ds.sel(time_metadata=15)
  • Closes #xxxx
  • Tests added
  • User visible changes (including notable bug fixes) are documented in whats-new.rst
  • [NA] New functions/methods are listed in api.rst

@max-sixty @benbovy

Copy link
Member

@benbovy benbovy left a comment

Choose a reason for hiding this comment

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

Great! Thanks @ianhi.

@max-sixty
Copy link
Collaborator

super, thanks @ianhi !

@max-sixty max-sixty added the plan to merge Final call for comments label Dec 18, 2025
@max-sixty max-sixty merged commit c374754 into pydata:main Dec 18, 2025
40 checks passed
@ianhi ianhi deleted the auto-xindex branch December 19, 2025 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plan to merge Final call for comments topic-indexing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatically create xindex?

3 participants