# xarray.DataArray.drop_sel

#### DataArray.drop_sel(labels=None, , errors='raise', \*\*labels_kwargs)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataarray.py#L3428-L3494)

Drop index labels from this DataArray.

* **Parameters:**
  * **labels** ([mapping](https://docs.python.org/3/glossary.html#term-mapping) of `Hashable` to `Any`) – Index labels to drop
  * **errors** (`{"raise", "ignore"}`, *default*: `"raise"`) – If ‘raise’, raises a ValueError error if
    any of the index labels passed are not
    in the dataset. If ‘ignore’, any given labels that are in the
    dataset are dropped and no error is raised.
  * **\*\*labels_kwargs** (`{dim: label, ...}`, *optional*) – The keyword arguments form of `dim` and `labels`
* **Returns:**
  **dropped** ([`DataArray`](xarray.DataArray.html.md#xarray.DataArray))

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('eb446b3f-0c9e-457f-a2f5-57bc7ebac4cc','d041d912-fc82-4ecb-b53c-4e1a138c5d3a','e1cf180f-d11b-479c-890d-a88fe9b21544','../lite/tree/../notebooks/index.html?path=5f76bfec_4d3b_4cbb_842f_a8b49bd995a6.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> da = xr.DataArray(
...     np.arange(25).reshape(5, 5),
...     coords={"x": np.arange(0, 9, 2), "y": np.arange(0, 13, 3)},
...     dims=("x", "y"),
... )
>>> da
<xarray.DataArray (x: 5, y: 5)> Size: 200B
array([[ 0,  1,  2,  3,  4],
       [ 5,  6,  7,  8,  9],
       [10, 11, 12, 13, 14],
       [15, 16, 17, 18, 19],
       [20, 21, 22, 23, 24]])
Coordinates:
  * x        (x) int64 40B 0 2 4 6 8
  * y        (y) int64 40B 0 3 6 9 12
```

```pycon
>>> da.drop_sel(x=[0, 2], y=9)
<xarray.DataArray (x: 3, y: 4)> Size: 96B
array([[10, 11, 12, 14],
       [15, 16, 17, 19],
       [20, 21, 22, 24]])
Coordinates:
  * x        (x) int64 24B 4 6 8
  * y        (y) int64 32B 0 3 6 12
```

```pycon
>>> da.drop_sel({"x": 6, "y": [0, 3]})
<xarray.DataArray (x: 4, y: 3)> Size: 96B
array([[ 2,  3,  4],
       [ 7,  8,  9],
       [12, 13, 14],
       [22, 23, 24]])
Coordinates:
  * x        (x) int64 32B 0 2 4 8
  * y        (y) int64 24B 6 9 12
```

<div id="e1cf180f-d11b-479c-890d-a88fe9b21544" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('eb446b3f-0c9e-457f-a2f5-57bc7ebac4cc','e1cf180f-d11b-479c-890d-a88fe9b21544')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('eb446b3f-0c9e-457f-a2f5-57bc7ebac4cc','e1cf180f-d11b-479c-890d-a88fe9b21544')">Open In Tab</button></div><div id="d041d912-fc82-4ecb-b53c-4e1a138c5d3a" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
