# 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('149a0cb3-922b-42db-9d4c-b93c436eade1','9d88bc4f-03cf-4837-aece-502b92760d54','50695d64-9922-4a46-82b4-b3c2146f82d9','../lite/tree/../notebooks/index.html?path=8af57361_c77a_4141_9e66_a2865eb56534.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="50695d64-9922-4a46-82b4-b3c2146f82d9" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('149a0cb3-922b-42db-9d4c-b93c436eade1','50695d64-9922-4a46-82b4-b3c2146f82d9')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('149a0cb3-922b-42db-9d4c-b93c436eade1','50695d64-9922-4a46-82b4-b3c2146f82d9')">Open In Tab</button></div><div id="9d88bc4f-03cf-4837-aece-502b92760d54" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
