# 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('986b979a-e311-4d8f-8d67-9d91c5888b1e','eb56d7ca-65dc-49b3-879e-e236ef030a9c','43dd7598-f3c4-4cd0-96db-d80120af9ac6','../lite/tree/../notebooks/index.html?path=b0a991ba_3c7b_4c81_99d3_87c6f5a84384.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="43dd7598-f3c4-4cd0-96db-d80120af9ac6" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('986b979a-e311-4d8f-8d67-9d91c5888b1e','43dd7598-f3c4-4cd0-96db-d80120af9ac6')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('986b979a-e311-4d8f-8d67-9d91c5888b1e','43dd7598-f3c4-4cd0-96db-d80120af9ac6')">Open In Tab</button></div><div id="eb56d7ca-65dc-49b3-879e-e236ef030a9c" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
