# xarray.CFTimeIndex.putmask

#### CFTimeIndex.putmask(mask, value)[[source]](https://github.com/pydata/xarray/blob/main/xarray/../.pixi/envs/doc/lib/python3.15/site-packages/pandas/core/indexes/base.py#L5817-L5852)

Return a new Index of the values set with the mask.

Replaces elements of the Index where the corresponding mask entry is
`True`, returning a new Index rather than modifying in place.

* **Parameters:**
  * **mask** ([array-like](https://numpy.org/doc/stable/glossary.html#term-array_like) of [`bool`](https://docs.python.org/3/builtins/functions.html#bool)) – Array of booleans denoting where values should be replaced.
  * **value** ([scalar](../user-guide/terminology.html.md#term-scalar)) – Scalar value to use to fill holes (e.g. 0).
    This value cannot be a list-likes.
* **Returns:**
  [`Index`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Index.html#pandas.Index) – A new Index of the values set with the mask.

#### SEE ALSO
[`numpy.putmask`](https://numpy.org/doc/stable/reference/generated/numpy.putmask.html#numpy.putmask)
: Changes elements of an array based on conditional and input values.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('ac8699fe-7eb5-4e89-bc1a-4988bcb38fa0','8af6fa75-012c-413e-bded-42433eb08483','591f7084-cdcd-41ea-86f3-99ed906a632d','../lite/tree/../notebooks/index.html?path=2af9638a_ab9d_4467_a99e_f7b85493cada.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> idx1 = pd.Index([1, 2, 3])
>>> idx2 = pd.Index([5, 6, 7])
>>> idx1.putmask([True, False, False], idx2)
Index([5, 2, 3], dtype='int64')
```

<div id="591f7084-cdcd-41ea-86f3-99ed906a632d" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('ac8699fe-7eb5-4e89-bc1a-4988bcb38fa0','591f7084-cdcd-41ea-86f3-99ed906a632d')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('ac8699fe-7eb5-4e89-bc1a-4988bcb38fa0','591f7084-cdcd-41ea-86f3-99ed906a632d')">Open In Tab</button></div><div id="8af6fa75-012c-413e-bded-42433eb08483" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
