andas.io.formats.style.Styler.set_uuid ](pandas.io.formats.style.Styler.set_uuid.html)
    * [ pandas.io.formats.style.Styler.clear ](pandas.io.formats.style.Styler.clear.html)
    * [ pandas.io.formats.style.Styler.pipe ](pandas.io.formats.style.Styler.pipe.html)
    * [ pandas.io.formats.style.Styler.highlight_null ](pandas.io.formats.style.Styler.highlight_null.html)
    * [ pandas.io.formats.style.Styler.highlight_max ](pandas.io.formats.style.Styler.highlight_max.html)
    * [ pandas.io.formats.style.Styler.highlight_min ](pandas.io.formats.style.Styler.highlight_min.html)
    * [ pandas.io.formats.style.Styler.highlight_between ](pandas.io.formats.style.Styler.highlight_between.html)
    * [ pandas.io.formats.style.Styler.highlight_quantile ](pandas.io.formats.style.Styler.highlight_quantile.html)
    * [ pandas.io.formats.style.Styler.background_gradient ](pandas.io.formats.style.Styler.background_gradient.html)
    * [ pandas.io.formats.style.Styler.text_gradient ](pandas.io.formats.style.Styler.text_gradient.html)
    * [ pandas.io.formats.style.Styler.bar ](pandas.io.formats.style.Styler.bar.html)
    * [ pandas.io.formats.style.Styler.to_html ](pandas.io.formats.style.Styler.to_html.html)
    * [ pandas.io.formats.style.Styler.to_latex ](pandas.io.formats.style.Styler.to_latex.html)
    * [ pandas.io.formats.style.Styler.to_excel ](pandas.io.formats.style.Styler.to_excel.html)
    * [ pandas.io.formats.style.Styler.to_string ](pandas.io.formats.style.Styler.to_string.html)
    * [ pandas.io.formats.style.Styler.export ](pandas.io.formats.style.Styler.export.html)
    * [ pandas.io.formats.style.Styler.use ](pandas.io.formats.style.Styler.use.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ Style ](../style.html)
  * pandas.io.fo... 

#  pandas.io.formats.style.Styler.map_index  #

Styler.  map_index  (  _ func  _ , _ axis  =  0  _ , _ level  =  None  _ , _
**  kwargs  _ )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/io/formats/style.py#L1957-L1984) #

    

Apply a CSS-styling function to the index or column headers, elementwise.

Updates the HTML representation with the result.

New in version 1.4.0.

New in version 2.1.0:  Styler.applymap_index was deprecated and renamed to
Styler.map_index.

Parameters  :

    

**func** function

    

` func  ` should take a scalar and return a string.

**axis** {0, 1, âindexâ, âcolumnsâ}

    

The headers over which to apply the function.

**level** int, str, list, optional

    

If index is MultiIndex the level(s) over which to apply the function.

****kwargs** dict

    

Pass along to ` func  ` .

Returns  :

    

Styler

    

See also

[ ` Styler.apply_index  `
](pandas.io.formats.style.Styler.apply_index.html#pandas.io.formats.style.Styler.apply_index
"pandas.io.formats.style.Styler.apply_index")

    

Apply a CSS-styling function to headers level-wise.

[ ` Styler.apply  `
](pandas.io.formats.style.Styler.apply.html#pandas.io.formats.style.Styler.apply
"pandas.io.formats.style.Styler.apply")

    

Apply a CSS-styling function column-wise, row-wise, or table-wise.

[ ` Styler.map  `
](pandas.io.formats.style.Styler.map.html#pandas.io.formats.style.Styler.map
"pandas.io.formats.style.Styler.map")

    

Apply a CSS-styling function elementwise.

Notes

Each input to ` func  ` will be an index value, if an Index, or a level value
of a MultiIndex. The output of ` func  ` should be CSS styles as a string, in
the format âattribute: value; attribute2: value2; â¦â or, if nothing is
to be applied to that element, an empty string or ` None  ` .

Examples

Basic usage to conditionally highlight values in the index.

    
    
    >>> df = pd.DataFrame([[1,2], [3,4]], index=["A", "B"])
    >>> def color_b(s):