# xarray.CFTimeIndex.take

#### CFTimeIndex.take(indices, axis=0, allow_fill=<no_default>, fill_value=<no_default>, \*\*kwargs)[[source]](https://github.com/pydata/xarray/blob/main/xarray/../.pixi/envs/doc/lib/python3.15/site-packages/pandas/core/indexes/base.py#L1218-L1328)

Return a new Index of the values selected by the indices.

For internal compatibility with numpy arrays.

* **Parameters:**
  * **indices** ([array-like](https://numpy.org/doc/stable/glossary.html#term-array_like)) – Indices to be taken.
  * **axis** (`{0 or 'index'}`, *optional*) – The axis over which to select values, always 0 or ‘index’.
  * **allow_fill** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *optional*) – How to handle negative values in indices.
    * False: negative values in indices indicate positional indices
      from the right, matching [`numpy.take()`](https://numpy.org/doc/stable/reference/generated/numpy.take.html#numpy.take).
    * True: negative values in indices indicate missing values. `-1`
      entries are set to `fill_value` (using the default NA value of
      the caller’s dtype if not supplied). Any other negative values
      raise a `ValueError`.
    * Not supplied: defaults to `allow_fill=False` unless `fill_value`
      is explicitly provided, in which case fill semantics apply
      (`allow_fill=True`).
  * **fill_value** ([scalar](../user-guide/terminology.html.md#term-scalar), *optional*) – If fill semantics apply (see `allow_fill`), indices specified by
    `-1` are filled with `fill_value`. Not specifying `fill_value`
    or passing `fill_value=None` will fill using the default NA value
    of the caller’s dtype. If the Index’s dtype cannot hold
    `fill_value`, the result is promoted to a common dtype (e.g. an
    integer Index + `np.nan` fill is cast to float, while an integer
    Index + a string fill is cast to object).
  * **\*\*kwargs** – Required for compatibility with numpy.
* **Returns:**
  [`Index`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Index.html#pandas.Index) – An index formed of elements at the given indices. Will be the same
  type as self, except for RangeIndex.

#### SEE ALSO
[`numpy.ndarray.take`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.take.html#numpy.ndarray.take)
: Return an array formed from the elements of a at the given indices.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('6194f0fd-5b97-4aa8-adfb-55064650264f','bad4b071-0ee4-4a70-94f7-584cc93cec50','58508c77-358d-433d-92eb-ecceb086b02b','../lite/tree/../notebooks/index.html?path=65814cd4_1859_44e6_b77a_5aff046d52a3.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> idx = pd.Index(["a", "b", "c"])
>>> idx.take([2, 2, 1, 2])
Index(['c', 'c', 'b', 'c'], dtype='str')
```

<div id="58508c77-358d-433d-92eb-ecceb086b02b" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('6194f0fd-5b97-4aa8-adfb-55064650264f','58508c77-358d-433d-92eb-ecceb086b02b')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('6194f0fd-5b97-4aa8-adfb-55064650264f','58508c77-358d-433d-92eb-ecceb086b02b')">Open In Tab</button></div><div id="bad4b071-0ee4-4a70-94f7-584cc93cec50" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
