# xarray.DataArray.isel

#### DataArray.isel(indexers=None, drop=False, missing_dims='raise', \*\*indexers_kwargs)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataarray.py#L1633-L1728)

Return a new DataArray whose data is given by selecting indexes
along the specified dimension(s).

* **Parameters:**
  * **indexers** ([`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict), *optional*) – A dict with keys matching dimensions and values given
    by integers, slice objects or arrays.
    indexer can be an integer, slice, array-like or DataArray.
    If DataArrays are passed as indexers, xarray-style indexing will be
    carried out. See [Indexing and selecting data](../user-guide/indexing.html.md#indexing) for the details.
    One of indexers or indexers_kwargs must be provided.
  * **drop** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *default*: [`False`](https://docs.python.org/3/builtins/constants.html#False)) – If `drop=True`, drop coordinates variables indexed by integers
    instead of making them scalar.
  * **missing_dims** (`{"raise", "warn", "ignore"}`, *default*: `"raise"`) – What to do if dimensions that should be selected from are not present in the
    DataArray:
    - “raise”: raise an exception
    - “warn”: raise a warning, and ignore the missing dimensions
    - “ignore”: ignore the missing dimensions
  * **\*\*indexers_kwargs** (`{dim: indexer, ...}`, *optional*) – The keyword arguments form of `indexers`.
* **Returns:**
  **indexed** ([`xarray.DataArray`](xarray.DataArray.html.md#xarray.DataArray))

#### SEE ALSO
[`Dataset.isel`](xarray.Dataset.isel.html.md#xarray.Dataset.isel)
[`DataArray.sel`](xarray.DataArray.sel.html.md#xarray.DataArray.sel)

[Indexing](https://tutorial.xarray.dev/intermediate/indexing/indexing.html)
: Tutorial material on indexing with Xarray objects

[Indexing and Selecting Data](https://tutorial.xarray.dev/fundamentals/02.1_indexing_Basic.html)
: Tutorial material on basics of indexing

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('29d4c678-ef0b-4273-b1b1-bc4496556635','cdff739d-fcb5-4feb-9332-93c5a071beaf','98cd7292-6317-4bff-8c27-142ac6115cb1','../lite/tree/../notebooks/index.html?path=c9d22360_a44b_4416_914d_5813791e09de.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> da = xr.DataArray(np.arange(25).reshape(5, 5), 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]])
Dimensions without coordinates: x, y
```

```pycon
>>> tgt_x = xr.DataArray(np.arange(0, 5), dims="points")
>>> tgt_y = xr.DataArray(np.arange(0, 5), dims="points")
>>> da = da.isel(x=tgt_x, y=tgt_y)
>>> da
<xarray.DataArray (points: 5)> Size: 40B
array([ 0,  6, 12, 18, 24])
Dimensions without coordinates: points
```

<div id="98cd7292-6317-4bff-8c27-142ac6115cb1" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('29d4c678-ef0b-4273-b1b1-bc4496556635','98cd7292-6317-4bff-8c27-142ac6115cb1')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('29d4c678-ef0b-4273-b1b1-bc4496556635','98cd7292-6317-4bff-8c27-142ac6115cb1')">Open In Tab</button></div><div id="cdff739d-fcb5-4feb-9332-93c5a071beaf" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
