pandas.io.formats.style.Styler.where¶
- Styler.where(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.
- Parameters
- condcallable
condshould take a scalar and return a boolean.- valuestr
Applied when
condreturns true.- otherstr
Applied when
condreturns false.- subsetIndexSlice
A valid indexer to limit
datato before applying the function. Consider using a pandas.IndexSlice.- **kwargsdict
Pass along to
cond.
- Returns
- selfStyler
See also
Styler.applymapUpdates the HTML representation with the result.