# xarray.DataArray.reindex

#### DataArray.reindex(indexers=None, \*, method=None, tolerance=None, copy=True, fill_value=<NA>, \*\*indexers_kwargs)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataarray.py#L2299-L2389)

Conform this object onto the indexes of another object, filling in
missing values with `fill_value`. The default fill value is NaN.

* **Parameters:**
  * **indexers** ([`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict), *optional*) – Dictionary with keys given by dimension names and values given by
    arrays of coordinates tick labels. Any mismatched coordinate
    values will be filled in with NaN, and any mismatched dimension
    names will simply be ignored.
    One of indexers or indexers_kwargs must be provided.
  * **copy** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *optional*) – If `copy=True`, data in the return value is always copied. If
    `copy=False` and reindexing is unnecessary, or can be performed
    with only slice operations, then the output may share memory with
    the input. In either case, a new xarray object is always returned.
  * **method** (`{None, 'nearest', 'pad'/'ffill', 'backfill'/'bfill'}`, *optional*) – Method to use for filling index values in `indexers` not found on
    this data array:
    - None (default): don’t fill gaps
    - pad / ffill: propagate last valid index value forward
    - backfill / bfill: propagate next valid index value backward
    - nearest: use nearest valid index value
  * **tolerance** (`float | Iterable[float] | str | None`, *default*: [`None`](https://docs.python.org/3/builtins/constants.html#None)) – Maximum distance between original and new labels for inexact
    matches. The values of the index at the matching locations must
    satisfy the equation `abs(index[indexer] - target) <= tolerance`.
    Tolerance may be a scalar value, which applies the same tolerance
    to all values, or list-like, which applies variable tolerance per
    element. List-like must be the same size as the index and its dtype
    must exactly match the index’s type.
  * **fill_value** ([scalar](../user-guide/terminology.html.md#term-scalar) or [dict-like](https://docs.python.org/3/glossary.html#term-mapping), *optional*) – Value to use for newly missing values. If a dict-like, maps
    variable names (including coordinates) to fill values. Use this
    data array’s name to refer to the data array’s values.
  * **\*\*indexers_kwargs** (`{dim: indexer, ...}`, *optional*) – The keyword arguments form of `indexers`.
    One of indexers or indexers_kwargs must be provided.
* **Returns:**
  **reindexed** ([`DataArray`](xarray.DataArray.html.md#xarray.DataArray)) – Another dataset array, with this array’s data but replaced
  coordinates.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('0cf46ee3-7663-43d7-a002-64e52d132e3d','f393121d-bdb8-4adf-aaed-48cdd4ba61fd','783e9f5e-7197-410e-97f1-b6c55a38995e','../lite/tree/../notebooks/index.html?path=6ba84b4a_6b14_4881_b8fe_4e8437d9231b.ipynb','None')">Try it in your browser!</button></div>

Reverse latitude:

```pycon
>>> da = xr.DataArray(
...     np.arange(4),
...     coords=[np.array([90, 89, 88, 87])],
...     dims="lat",
... )
>>> da
<xarray.DataArray (lat: 4)> Size: 32B
array([0, 1, 2, 3])
Coordinates:
  * lat      (lat) int64 32B 90 89 88 87
>>> da.reindex(lat=da.lat[::-1])
<xarray.DataArray (lat: 4)> Size: 32B
array([3, 2, 1, 0])
Coordinates:
  * lat      (lat) int64 32B 87 88 89 90
```

<div id="783e9f5e-7197-410e-97f1-b6c55a38995e" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('0cf46ee3-7663-43d7-a002-64e52d132e3d','783e9f5e-7197-410e-97f1-b6c55a38995e')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('0cf46ee3-7663-43d7-a002-64e52d132e3d','783e9f5e-7197-410e-97f1-b6c55a38995e')">Open In Tab</button></div><div id="f393121d-bdb8-4adf-aaed-48cdd4ba61fd" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>

#### SEE ALSO
[`DataArray.reindex_like`](xarray.DataArray.reindex_like.html.md#xarray.DataArray.reindex_like), [`align`](xarray.align.html.md#xarray.align)
