Skip to content

drop_sel indices in dimension that doesn't have coordinates? #4658

@shaunc

Description

@shaunc

Is your feature request related to a problem? Please describe.

I am trying to drop particular indices from a dimension that doesn't have coordinates.

Following: drop_sel() documentation,
but leaving out the coordinate labels:

data = np.random.randn(2, 3)
ds = xr.Dataset({"A": (["x", "y"], data)})
ds.drop_sel(y=[1])

gives me an error.

Describe the solution you'd like

I would think drop_isel should exist and work in analogy to drop_sel as isel does to sel.

Describe alternatives you've considered

As far as I know, I could either create coordinates especially to in order to drop, or rebuild a new dataset. Both are not congenial. (I'd be grateful to know if there is actually a straightforward way to do this I've overlooked.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions