pandas.io.formats.style.Styler.apply

pandas 3.1.1 · Styling · method

Generate CSS styles by passing an entire column, row or table to a style function.

Call syntax

Styler.apply(func, axis=0, subset=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 or 'index', 1 or 'columns', None}

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

subset Optional
Positional or keyword
Default None
label, array-like, IndexSlice

Restrict the operation to these labels instead of considering the whole object.

**kwargs Optional
Additional keyword arguments

Returns

Styler