# xarray.CFTimeIndex.where

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

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('fc0d6d8c-448f-4b75-b1e2-7bceb733c2c9','8c7b247f-9666-4a57-b697-c7bd0746f291','6fdd0512-d409-48e4-abb8-68648bd916f8','../lite/tree/../notebooks/index.html?path=66bd043a_2f8e_4536_bb4d_deed16c018d3.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="6fdd0512-d409-48e4-abb8-68648bd916f8" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('fc0d6d8c-448f-4b75-b1e2-7bceb733c2c9','6fdd0512-d409-48e4-abb8-68648bd916f8')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('fc0d6d8c-448f-4b75-b1e2-7bceb733c2c9','6fdd0512-d409-48e4-abb8-68648bd916f8')">Open In Tab</button></div><div id="8c7b247f-9666-4a57-b697-c7bd0746f291" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
