# xarray.CFTimeIndex.where

#### CFTimeIndex.where(cond, other=None)[[source]](https://github.com/pydata/xarray/blob/main/xarray/../.pixi/envs/doc/lib/python3.14/site-packages/pandas/core/indexes/base.py#L5234-L5272)

Replace values where the condition is False.

The replacement is taken from other.

* **Parameters:**
  * **cond** (`bool array-like with the same length as self`) – Condition to select the values on.
  * **other** ([scalar](../user-guide/terminology.html.md#term-scalar), or [array-like](https://numpy.org/doc/stable/glossary.html#term-array_like), *default* [`None`](https://docs.python.org/3/builtins/constants.html#None)) – Replacement if the condition is False.
* **Returns:**
  [`pandas.Index`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Index.html#pandas.Index) – A copy of self with values replaced from other
  where the condition is False.

#### SEE ALSO
`Series.where`
: Same method for Series.

`DataFrame.where`
: Same method for DataFrame.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('a0f65a22-564b-46ef-8845-71985dce8edc','6b2c4c00-ec5d-4c3b-8a13-50635eaa375b','16873033-5b3d-42bf-a16a-49067ff36ae2','../lite/tree/../notebooks/index.html?path=c415c74e_410a_4b03_bdd1_7f6d70971e9a.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.where(idx.isin(["car", "train"]), "other")
Index(['car', 'other', 'train', 'other'], dtype='str')
```

<div id="16873033-5b3d-42bf-a16a-49067ff36ae2" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('a0f65a22-564b-46ef-8845-71985dce8edc','16873033-5b3d-42bf-a16a-49067ff36ae2')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('a0f65a22-564b-46ef-8845-71985dce8edc','16873033-5b3d-42bf-a16a-49067ff36ae2')">Open In Tab</button></div><div id="6b2c4c00-ec5d-4c3b-8a13-50635eaa375b" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
