# dask.dataframe.Index.map

Index.map(arg, na_action=None, meta=<no_default>, is_monotonic=False)

  Map values using an input mapping or function.

  This docstring was copied from pandas.core.indexes.base.Index.map.

  Some inconsistencies with the Dask version may exist.

  Note that this method clears any known divisions.

  If your mapping function is monotonically increasing then use is_monotonic to apply the mapping function to the old divisions and assign the new divisions to the output.

  Parameters:
    mapper function, dict, or Series (Not supported in Dask)

      Mapping correspondence.

    na_action{None, ‘ignore’}

      If ‘ignore’, propagate NA values, without passing them to the mapping correspondence.

      > metapd.DataFrame, pd.Series, dict, iterable, tuple, optional

      >   An empty `pd.DataFrame` or `pd.Series` that matches the dtypes and column names of the output. This metadata is necessary for many algorithms in dask dataframe to work. For ease of use, some alternative inputs are also available. Instead of a `DataFrame`, a `dict` of `{name: dtype}` or iterable of `(name, dtype)` can be provided (note that the order of the names should match the order of the columns). Instead of a series, a tuple of `(name, dtype)` can be used. If not provided, dask will try to infer the metadata. This may lead to unexpected results, so providing `meta` is recommended. For more information, see `dask.dataframe.utils.make_meta`.

  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.

  Examples

      >>> idx = pd.Index([1, 2, 3])
      >>> idx.map({1: 'a', 2: 'b', 3: 'c'})
      Index(['a', 'b', 'c'], dtype='object')

  Using map with a function:

      >>> 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='object')

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