# xarray.Dataset.thin

#### Dataset.thin(indexers=None, \*\*indexers_kwargs)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataset.py#L3312-L3395)

Returns a new dataset with each array indexed along every n-th
value for the specified dimension(s)

* **Parameters:**
  * **indexers** ([`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict) or [`int`](https://docs.python.org/3/builtins/functions.html#int)) – A dict with keys matching dimensions and integer values n
    or a single integer n applied over all dimensions.
    One of indexers or indexers_kwargs must be provided.
  * **\*\*indexers_kwargs** (`{dim: n, ...}`, *optional*) – The keyword arguments form of `indexers`.
    One of indexers or indexers_kwargs must be provided.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('46450546-dfd6-432f-8848-327cc8c8f49a','0b5214d1-ee85-43cd-b91b-cb6a3fec1080','7c278375-c6ce-4505-9e9d-0ca85df8d251','../lite/tree/../notebooks/index.html?path=fd8b360e_73d8_4f86_8e96_715ecfae50ca.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> x_arr = np.arange(0, 26)
>>> x_arr
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, 25])
>>> x = xr.DataArray(
...     np.reshape(x_arr, (2, 13)),
...     dims=("x", "y"),
...     coords={"x": [0, 1], "y": np.arange(0, 13)},
... )
>>> x_ds = xr.Dataset({"foo": x})
>>> x_ds
<xarray.Dataset> Size: 328B
Dimensions:  (x: 2, y: 13)
Coordinates:
  * x        (x) int64 16B 0 1
  * y        (y) int64 104B 0 1 2 3 4 5 6 7 8 9 10 11 12
Data variables:
    foo      (x, y) int64 208B 0 1 2 3 4 5 6 7 8 ... 17 18 19 20 21 22 23 24 25
```

```pycon
>>> x_ds.thin(3)
<xarray.Dataset> Size: 88B
Dimensions:  (x: 1, y: 5)
Coordinates:
  * x        (x) int64 8B 0
  * y        (y) int64 40B 0 3 6 9 12
Data variables:
    foo      (x, y) int64 40B 0 3 6 9 12
>>> x.thin({"x": 2, "y": 5})
<xarray.DataArray (x: 1, y: 3)> Size: 24B
array([[ 0,  5, 10]])
Coordinates:
  * x        (x) int64 8B 0
  * y        (y) int64 24B 0 5 10
```

<div id="7c278375-c6ce-4505-9e9d-0ca85df8d251" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('46450546-dfd6-432f-8848-327cc8c8f49a','7c278375-c6ce-4505-9e9d-0ca85df8d251')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('46450546-dfd6-432f-8848-327cc8c8f49a','7c278375-c6ce-4505-9e9d-0ca85df8d251')">Open In Tab</button></div><div id="0b5214d1-ee85-43cd-b91b-cb6a3fec1080" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>

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