pandas.io.formats.style.Styler.whereΒΆ

Styler.where(self, cond, value, other=None, subset=None, **kwargs)[source]ΒΆ

Apply a function elementwise.

Updates the HTML representation with a style which is selected in accordance with the return value of a function.

New in version 0.21.0.

Parameters
condcallable

cond should take a scalar and return a boolean.

valuestr

Applied when cond returns true.

otherstr

Applied when cond returns false.

subsetIndexSlice

A valid indexer to limit data to before applying the function. Consider using a pandas.IndexSlice.

**kwargsdict

Pass along to cond.

Returns
selfStyler

See also

Styler.applymap