# xarray.CFTimeIndex.map

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

Map values using an input mapping or function.

Applies a function, dict, or Series to each element of the Index,
returning a new Index (or MultiIndex if tuples are returned).

* **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('3f51ccef-b4f5-4923-8eba-ceb8a1400f74','2e4e0e7a-3801-49a7-ade1-9b5659cce59e','b5519f2b-e506-4142-84bb-13a85e695b30','../lite/tree/../notebooks/index.html?path=5b3d330a_df31_461b_b210_3ed822f47a4a.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="b5519f2b-e506-4142-84bb-13a85e695b30" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('3f51ccef-b4f5-4923-8eba-ceb8a1400f74','b5519f2b-e506-4142-84bb-13a85e695b30')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('3f51ccef-b4f5-4923-8eba-ceb8a1400f74','b5519f2b-e506-4142-84bb-13a85e695b30')">Open In Tab</button></div><div id="2e4e0e7a-3801-49a7-ade1-9b5659cce59e" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
