# xarray.CFTimeIndex.duplicated

#### CFTimeIndex.duplicated(keep='first')[[source]](https://github.com/pydata/xarray/blob/main/xarray/../.pixi/envs/doc/lib/python3.14/site-packages/pandas/core/indexes/base.py#L2906-L2964)

Indicate duplicate index values.

Duplicated values are indicated as `True` values in the resulting
array. Either all duplicates, all except the first, or all except the
last occurrence of duplicates can be indicated.

* **Parameters:**
  **keep** (`{'first', 'last', False}`, *default* `'first'`) – The value or values in a set of duplicates to mark as missing.
  - ‘first’ : Mark duplicates as `True` except for the first
    occurrence.
  - ‘last’ : Mark duplicates as `True` except for the last
    occurrence.
  - `False` : Mark all duplicates as `True`.
* **Returns:**
  `np.ndarray[bool]` – A numpy array of boolean values indicating duplicate index values.

#### SEE ALSO
`Series.duplicated`
: Equivalent method on pandas.Series.

`DataFrame.duplicated`
: Equivalent method on pandas.DataFrame.

`Index.drop_duplicates`
: Remove duplicate values from Index.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('f8dbedfb-4867-4bc2-84b0-89863c229d2c','e2a27e7e-3cd1-4def-9473-1783968ba37f','29245424-d057-4b51-8777-a30144ba47f4','../lite/tree/../notebooks/index.html?path=566759ab_7473_4679_977e_270bc2469156.ipynb','None')">Try it in your browser!</button></div>

By default, for each set of duplicated values, the first occurrence is
set to False and all others to True:

```pycon
>>> idx = pd.Index(["llama", "cow", "llama", "beetle", "llama"])
>>> idx.duplicated()
array([False, False,  True, False,  True])
```

which is equivalent to

```pycon
>>> idx.duplicated(keep="first")
array([False, False,  True, False,  True])
```

By using ‘last’, the last occurrence of each set of duplicated values
is set on False and all others on True:

```pycon
>>> idx.duplicated(keep="last")
array([ True, False,  True, False, False])
```

By setting keep on `False`, all duplicates are True:

```pycon
>>> idx.duplicated(keep=False)
array([ True, False,  True, False,  True])
```

<div id="29245424-d057-4b51-8777-a30144ba47f4" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('f8dbedfb-4867-4bc2-84b0-89863c229d2c','29245424-d057-4b51-8777-a30144ba47f4')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('f8dbedfb-4867-4bc2-84b0-89863c229d2c','29245424-d057-4b51-8777-a30144ba47f4')">Open In Tab</button></div><div id="e2a27e7e-3cd1-4def-9473-1783968ba37f" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
