code: def as_format(item, format_str='.2f'):
      
      if isinstance(item, pd.Series):
          return item.map(lambda x: format(x, format_str))
      elif isinstance(item, pd.DataFrame):
          return item.applymap(lambda x: format(x, format_str))
docs: Map a format string over a pandas object.