# xarray.DataArray.head

#### DataArray.head(indexers=None, \*\*indexers_kwargs)[[source]](https://github.com/pydata/xarray/blob/v2026.09.0/xarray/core/dataarray.py#L1864-L1905)

Return a new DataArray whose data is given by the first n
values along the specified dimension(s). Default n = 5

#### SEE ALSO
[`Dataset.head`](xarray.Dataset.head.html.md#xarray.Dataset.head), [`DataArray.tail`](xarray.DataArray.tail.html.md#xarray.DataArray.tail), [`DataArray.thin`](xarray.DataArray.thin.html.md#xarray.DataArray.thin)

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('bc5c3879-ee4a-41e5-b2f9-3feb5c52ca19','0ead1413-8e3a-4e7a-b394-3e98b76833ec','95a50f81-8b12-4245-b666-532a70118548','../lite/tree/../notebooks/index.html?path=bc3e6a3f_b23c_404f_a3e5_b05aba6821ef.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
>>> da.head(x=1)
<xarray.DataArray (x: 1, y: 5)> Size: 40B
array([[0, 1, 2, 3, 4]])
Dimensions without coordinates: x, y
```

```pycon
>>> da.head({"x": 2, "y": 2})
<xarray.DataArray (x: 2, y: 2)> Size: 32B
array([[0, 1],
       [5, 6]])
Dimensions without coordinates: x, y
```

<div id="95a50f81-8b12-4245-b666-532a70118548" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('bc5c3879-ee4a-41e5-b2f9-3feb5c52ca19','95a50f81-8b12-4245-b666-532a70118548')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('bc5c3879-ee4a-41e5-b2f9-3feb5c52ca19','95a50f81-8b12-4245-b666-532a70118548')">Open In Tab</button></div><div id="0ead1413-8e3a-4e7a-b394-3e98b76833ec" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
