# xarray.CFTimeIndex.rename

#### CFTimeIndex.rename(name, , inplace=False)[[source]](https://github.com/pydata/xarray/blob/main/xarray/../.pixi/envs/doc/lib/python3.14/site-packages/pandas/core/indexes/base.py#L2062-L2111)

Alter Index or MultiIndex name.

Able to set new names without level. Defaults to returning new index.
Length of names must match number of levels in MultiIndex.

* **Parameters:**
  * **name** (`Hashable` or `a sequence` of `the previous`) – Name(s) to set.
  * **inplace** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *default* [`False`](https://docs.python.org/3/builtins/constants.html#False)) – Modifies the object directly, instead of creating a new Index or
    MultiIndex.
* **Returns:**
  [`Index`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Index.html#pandas.Index) or [`None`](https://docs.python.org/3/builtins/constants.html#None) – The same type as the caller or None if `inplace=True`.

#### SEE ALSO
`Index.set_names`
: Able to set new names partially and by level.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('16f6788b-65f0-430c-9d86-09d31fc395a0','c4bfa7e1-b375-4547-a4ee-445b976d5da8','8922bd5e-c6b6-4501-90d8-976d59430e78','../lite/tree/../notebooks/index.html?path=fe6cfa5c_d642_440a_b16a_9b1480cd5c87.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> idx = pd.Index(["A", "C", "A", "B"], name="score")
>>> idx.rename("grade")
Index(['A', 'C', 'A', 'B'], dtype='str', name='grade')
```

```pycon
>>> idx = pd.MultiIndex.from_product(
...     [["python", "cobra"], [2018, 2019]], names=["kind", "year"]
... )
>>> idx
MultiIndex([('python', 2018),
            ('python', 2019),
            ( 'cobra', 2018),
            ( 'cobra', 2019)],
           names=['kind', 'year'])
>>> idx.rename(["species", "year"])
MultiIndex([('python', 2018),
            ('python', 2019),
            ( 'cobra', 2018),
            ( 'cobra', 2019)],
           names=['species', 'year'])
>>> idx.rename("species")
Traceback (most recent call last):
TypeError: Must pass list-like as `names`.
```

<div id="8922bd5e-c6b6-4501-90d8-976d59430e78" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('16f6788b-65f0-430c-9d86-09d31fc395a0','8922bd5e-c6b6-4501-90d8-976d59430e78')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('16f6788b-65f0-430c-9d86-09d31fc395a0','8922bd5e-c6b6-4501-90d8-976d59430e78')">Open In Tab</button></div><div id="c4bfa7e1-b375-4547-a4ee-445b976d5da8" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
