# xarray.CFTimeIndex.argsort

#### CFTimeIndex.argsort(\*args, \*\*kwargs)[[source]](https://github.com/pydata/xarray/blob/main/xarray/../.pixi/envs/doc/lib/python3.15/site-packages/pandas/core/indexes/base.py#L6325-L6366)

Return the integer indices that would sort the index.

This method returns an array of indices that indicate the order in
which elements of the index should be arranged to produce a sorted
index. It delegates to the underlying array’s `argsort` method.

* **Parameters:**
  * **\*args** – Passed to numpy.ndarray.argsort.
  * **\*\*kwargs** – Passed to numpy.ndarray.argsort.
* **Returns:**
  `np.ndarray[np.intp]` – Integer indices that would sort the index if used as
  an indexer.

#### SEE ALSO
[`numpy.argsort`](https://numpy.org/doc/stable/reference/generated/numpy.argsort.html#numpy.argsort)
: Similar method for NumPy arrays.

`Index.sort_values`
: Return sorted copy of Index.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('0346daa5-e96d-405e-a785-96bbcf8f454c','c6bf63e1-19f7-4feb-948c-0bea91ca3584','1347d45e-b090-4686-af47-300dcbdb30bd','../lite/tree/../notebooks/index.html?path=3163c267_ea25_43f6_bb45_22ffaac70c8f.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> idx = pd.Index(["b", "a", "d", "c"])
>>> idx
Index(['b', 'a', 'd', 'c'], dtype='str')
```

```pycon
>>> order = idx.argsort()
>>> order
array([1, 0, 3, 2])
```

```pycon
>>> idx[order]
Index(['a', 'b', 'c', 'd'], dtype='str')
```

<div id="1347d45e-b090-4686-af47-300dcbdb30bd" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('0346daa5-e96d-405e-a785-96bbcf8f454c','1347d45e-b090-4686-af47-300dcbdb30bd')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('0346daa5-e96d-405e-a785-96bbcf8f454c','1347d45e-b090-4686-af47-300dcbdb30bd')">Open In Tab</button></div><div id="c6bf63e1-19f7-4feb-948c-0bea91ca3584" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
