# 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('473d0ca9-bc02-4875-9333-6ac45f79340e','3eb478fb-31f0-4619-8064-f790649e8654','0c002603-cbd1-4488-8605-9777c428a9ba','../lite/tree/../notebooks/index.html?path=f5bdac42_0003_4f65_a0ec_5e73a4d3853e.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="0c002603-cbd1-4488-8605-9777c428a9ba" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('473d0ca9-bc02-4875-9333-6ac45f79340e','0c002603-cbd1-4488-8605-9777c428a9ba')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('473d0ca9-bc02-4875-9333-6ac45f79340e','0c002603-cbd1-4488-8605-9777c428a9ba')">Open In Tab</button></div><div id="3eb478fb-31f0-4619-8064-f790649e8654" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
