code: def format_rows(row, center, fullrange=None, interquartile=None,
                  custom_format='{:.2f}'):
      
      if (fullrange or 0) + (interquartile or 0) == 1:
          legend = '{} ({})'.format(center, 'max, min' if fullrange is True
                                    else 'interquartile range')
          index = row.index.droplevel(2).drop_duplicates()
          count_arg = dict(tuples=[('count', '')], names=[None, legend])
      else:
          msg = 'displaying multiple range formats simultaneously not supported'
          raise NotImplementedError(msg)
  
      ret = pd.Series(index=pd.MultiIndex.from_tuples(**count_arg).append(index))
  
      row = row.sort_index()
      center = '50%' if center == 'median' else center
  
      # get maximum of `count` and write to first entry of return series
      count = max([i for i in row.loc[(slice(None), slice(None), 'count')]
                   if not np.isnan(i)])
      ret.loc[('count', '')] = ('{:.0f}'.format(count)) if count > 1 else ''
  
      # set upper and lower for the range
      upper, lower = ('max', 'min') if fullrange is True else ('75%', '25%')
  
      # format `describe()` columns to string output
      for i in index:
          x = row.loc[i]
          _count = x['count']
          if np.isnan(_count) or _count == 0:
              s = ''
          elif _count > 1:
              s = '{f} ({f}, {f})'.format(f=custom_format)\
                  .format(x[center], x[upper], x[lower])
          elif _count == 1:
              s = '{f}'.format(f=custom_format).format(x['50%'])
          # add count of this section as `[]` if different from count_max
          if 0 < _count < count:
              s += ' [{:.0f}]'.format(_count)
          ret.loc[i] = s
  
      return ret
docs: Format a row with `describe()` columns to a concise string