# xarray.CFTimeIndex.duplicated

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

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('81061f46-45e9-4820-bc6e-47f2f93ca203','16700d34-2898-4937-94f6-9fbdb96075c8','8497bbda-76dc-4866-9d9f-7816a01705d8','../lite/tree/../notebooks/index.html?path=0de06176_5c9d_423c_b6d0_cd0ebbc1b881.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="8497bbda-76dc-4866-9d9f-7816a01705d8" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('81061f46-45e9-4820-bc6e-47f2f93ca203','8497bbda-76dc-4866-9d9f-7816a01705d8')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('81061f46-45e9-4820-bc6e-47f2f93ca203','8497bbda-76dc-4866-9d9f-7816a01705d8')">Open In Tab</button></div><div id="16700d34-2898-4937-94f6-9fbdb96075c8" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
