# xarray.DataArray.head

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

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('a528c40a-f4c3-4f8b-b687-d94df65bafc8','f18fc0b4-6ac2-4df2-8120-5ffaddf428aa','6946f1ac-4996-438b-bf65-56bd24d6c98b','../lite/tree/../notebooks/index.html?path=1b9dc2c6_0bde_40ed_b418_4f1f4ff84c7c.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="6946f1ac-4996-438b-bf65-56bd24d6c98b" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('a528c40a-f4c3-4f8b-b687-d94df65bafc8','6946f1ac-4996-438b-bf65-56bd24d6c98b')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('a528c40a-f4c3-4f8b-b687-d94df65bafc8','6946f1ac-4996-438b-bf65-56bd24d6c98b')">Open In Tab</button></div><div id="f18fc0b4-6ac2-4df2-8120-5ffaddf428aa" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
