code: def _highlight_extrema(data, color='yellow', max_=True):
          
          attr = 'background-color: {0}'.format(color)
          if data.ndim == 1:  # Series from .apply
              if max_:
                  extrema = data == data.max()
              else:
                  extrema = data == data.min()
              return [attr if v else '' for v in extrema]
          else:  # DataFrame from .tee
              if max_:
                  extrema = data == data.max().max()
              else:
                  extrema = data == data.min().min()
              return pd.DataFrame(np.where(extrema, attr, ''),
                                  index=data.index, columns=data.columns)
docs: Highlight the min or max in a Series or DataFrame.