pandas.io.formats.style.Styler.map_index

pandas 3.1.1 · Styling · method

Apply a style callable to each individual index or column label.

Call syntax

Styler.map_index(func, axis=0, level=None, **kwargs)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
func Required
Positional or keyword
function

Supply a supported operation name or a callable, depending on this API.

axis Optional
Positional or keyword
Default 0
{0, 1, "index", "columns"}

Choose which axis the operation acts on. The accepted axis labels depend on the receiver.

level Optional
Positional or keyword
Default None
int, str, list

Choose an index level by name or integer position.

**kwargs Optional
Additional keyword arguments

Returns

Styler