# 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('fc394570-1405-417d-a606-b0a7852f09a4','523cd42e-b07d-49b5-880b-c31ec85ca78f','0d28dd1b-fc13-495a-931a-d79000f27ef9','../lite/tree/../notebooks/index.html?path=332e4ca3_3c05_4386_bd35_21a7b0577f38.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="0d28dd1b-fc13-495a-931a-d79000f27ef9" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('fc394570-1405-417d-a606-b0a7852f09a4','0d28dd1b-fc13-495a-931a-d79000f27ef9')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('fc394570-1405-417d-a606-b0a7852f09a4','0d28dd1b-fc13-495a-931a-d79000f27ef9')">Open In Tab</button></div><div id="523cd42e-b07d-49b5-880b-c31ec85ca78f" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
