# xarray.CFTimeIndex.reindex

#### CFTimeIndex.reindex(target, method=None, level=None, limit=None, tolerance=None)[[source]](https://github.com/pydata/xarray/blob/main/xarray/../.pixi/envs/doc/lib/python3.15/site-packages/pandas/core/indexes/base.py#L4339-L4455)

Create index with target’s values.

Optionally provides an indexer that maps the new labels back to the
original positions, and supports filling methods for non-exact matches.

* **Parameters:**
  * **target** (`an iterable`) – An iterable containing the values to be used for creating the new index.
  * **method** (`{None, 'pad'/'ffill', 'backfill'/'bfill', 'nearest'}`, *optional*) –
    * default: exact matches only.
    * pad / ffill: find the PREVIOUS index value if no exact match.
    * backfill / bfill: use NEXT index value if no exact match
    * nearest: use the NEAREST index value if no exact match. Tied
      distances are broken by preferring the larger index value.
  * **level** ([`int`](https://docs.python.org/3/builtins/functions.html#int), *optional*) – Level of multiindex.
  * **limit** ([`int`](https://docs.python.org/3/builtins/functions.html#int), *optional*) – Maximum number of consecutive labels in `target` to match for
    inexact matches.
  * **tolerance** ([`int`](https://docs.python.org/3/builtins/functions.html#int), [`float`](https://docs.python.org/3/builtins/functions.html#float), or `list-like`, *optional*) – 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 includes list, tuple, array, Series, and must be
    the same size as the index and its dtype must exactly match the
    index’s type.
* **Returns:**
  * **new_index** ([`Index`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Index.html#pandas.Index)) – Resulting index.
  * **indexer** (`np.ndarray[np.intp]` or [`None`](https://docs.python.org/3/builtins/constants.html#None)) – Indices of output values in original index.
* **Raises:**
  * [**TypeError**](https://docs.python.org/3/builtins/exceptions.html#TypeError) – If `method` passed along with `level`.
  * [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If non-unique multi-index
  * [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError) – If non-unique index and `method` or `limit` passed.

#### SEE ALSO
`Series.reindex`
: Conform Series to new index with optional filling logic.

`DataFrame.reindex`
: Conform DataFrame to new index with optional filling logic.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('2c4a1ccd-b702-4dc3-8ebf-a11e8efa6136','d2927008-45ac-493c-8382-4cd95cf91897','dc5816d1-c1aa-4b27-ba05-6d8e5698ed4f','../lite/tree/../notebooks/index.html?path=8309862c_e2dd_4538_b312_1c1a881a4751.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> idx = pd.Index(["car", "bike", "train", "tractor"])
>>> idx
Index(['car', 'bike', 'train', 'tractor'], dtype='str')
>>> idx.reindex(["car", "bike"])
(Index(['car', 'bike'], dtype='str'), array([0, 1]))
```

<div id="dc5816d1-c1aa-4b27-ba05-6d8e5698ed4f" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('2c4a1ccd-b702-4dc3-8ebf-a11e8efa6136','dc5816d1-c1aa-4b27-ba05-6d8e5698ed4f')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('2c4a1ccd-b702-4dc3-8ebf-a11e8efa6136','dc5816d1-c1aa-4b27-ba05-6d8e5698ed4f')">Open In Tab</button></div><div id="d2927008-45ac-493c-8382-4cd95cf91897" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
