@staticmethod<EOL><INDENT>def _highlight_extrema(data, color='<STR_LIT>', max_=True):<DEDENT>
attr = '<STR_LIT>'.format(color)<EOL>if data.ndim == <NUM_LIT:1>:  <EOL><INDENT>if max_:<EOL><INDENT>extrema = data == data.max()<EOL><DEDENT>else:<EOL><INDENT>extrema = data == data.min()<EOL><DEDENT>return [attr if v else '<STR_LIT>' for v in extrema]<EOL><DEDENT>else:  <EOL><INDENT>if max_:<EOL><INDENT>extrema = data == data.max().max()<EOL><DEDENT>else:<EOL><INDENT>extrema = data == data.min().min()<EOL><DEDENT>return pd.DataFrame(np.where(extrema, attr, '<STR_LIT>'),<EOL>index=data.index, columns=data.columns)<EOL><DEDENT>
Highlight the min or max in a Series or DataFrame.