pandas.io.formats.style.Styler.highlight_max — pandas 2.2.3 documentation (original) (raw)
Styler.highlight_max(subset=None, color='yellow', axis=0, props=None)[source]#
Highlight the maximum with a style.
Parameters:
subsetlabel, array-like, IndexSlice, optional
A valid 2d input to DataFrame.loc[], or, in the case of a 1d input or single key, to DataFrame.loc[:, ] where the columns are prioritised, to limit data
to before applying the function.
colorstr, default ‘yellow’
Background color to use for highlighting.
axis{0 or ‘index’, 1 or ‘columns’, None}, default 0
Apply to each column (axis=0
or 'index'
), to each row (axis=1
or 'columns'
), or to the entire DataFrame at once with axis=None
.
propsstr, default None
CSS properties to use for highlighting. If props
is given, color
is not used.
Returns:
Styler
Examples
df = pd.DataFrame({'A': [2, 1], 'B': [3, 4]}) df.style.highlight_max(color='yellow')
Please see:Table Visualization for more examples.