# xarray.CFTimeIndex.rename

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

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('ee812ab7-e326-4b55-9fcf-48e5721977dc','05593bef-7558-4256-a1f5-44122efa5f64','ce181280-c1ba-49ca-9a79-3b3e0c64d650','../lite/tree/../notebooks/index.html?path=740e954d_900f_4bb8_b08f_e6147d16c0cd.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="ce181280-c1ba-49ca-9a79-3b3e0c64d650" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('ee812ab7-e326-4b55-9fcf-48e5721977dc','ce181280-c1ba-49ca-9a79-3b3e0c64d650')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('ee812ab7-e326-4b55-9fcf-48e5721977dc','ce181280-c1ba-49ca-9a79-3b3e0c64d650')">Open In Tab</button></div><div id="05593bef-7558-4256-a1f5-44122efa5f64" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
