# xarray.CFTimeIndex.map

#### CFTimeIndex.map(mapper, na_action=None)[[source]](https://github.com/pydata/xarray/blob/main/xarray/../.pixi/envs/doc/lib/python3.14/site-packages/pandas/core/indexes/base.py#L6580-L6650)

Map values using an input mapping or function.

* **Parameters:**
  * **mapper** (`function`, [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict), or [`Series`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.html#pandas.Series)) – Mapping correspondence.
  * **na_action** (`{None, 'ignore'}`) – If ‘ignore’, propagate NA values, without passing them to the
    mapping correspondence.
* **Returns:**
  `Union[Index`, `MultiIndex]` – The output of the mapping function applied to the index.
  If the function returns a tuple with more than one element
  a MultiIndex will be returned.

#### SEE ALSO
`Index.where`
: Replace values where the condition is False.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('1673a9fc-1378-44c8-a189-e4bde9b585b5','641b01ec-0b78-4599-846a-bb30440dda45','fcf9090b-e054-417f-93a7-65a01c399b60','../lite/tree/../notebooks/index.html?path=2ce4efcd_56a3_4873_b4eb_2705cd6f5f66.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> idx = pd.Index([1, 2, 3])
>>> idx.map({1: "a", 2: "b", 3: "c"})
Index(['a', 'b', 'c'], dtype='str')
```

Using map with a function:

```pycon
>>> idx = pd.Index([1, 2, 3])
>>> idx.map("I am a {}".format)
Index(['I am a 1', 'I am a 2', 'I am a 3'], dtype='str')
```

```pycon
>>> idx = pd.Index(["a", "b", "c"])
>>> idx.map(lambda x: x.upper())
Index(['A', 'B', 'C'], dtype='str')
```

<div id="fcf9090b-e054-417f-93a7-65a01c399b60" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('1673a9fc-1378-44c8-a189-e4bde9b585b5','fcf9090b-e054-417f-93a7-65a01c399b60')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('1673a9fc-1378-44c8-a189-e4bde9b585b5','fcf9090b-e054-417f-93a7-65a01c399b60')">Open In Tab</button></div><div id="641b01ec-0b78-4599-846a-bb30440dda45" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
