code: def print_table(table, name=None, fmt=None):
      
      if isinstance(table, pd.Series):
          table = pd.DataFrame(table)
  
      if isinstance(table, pd.DataFrame):
          table.columns.name = name
  
      prev_option = pd.get_option('display.float_format')
      if fmt is not None:
          pd.set_option('display.float_format', lambda x: fmt.format(x))
  
      display(table)
  
      if fmt is not None:
          pd.set_option('display.float_format', prev_option)
docs: Pretty print a pandas DataFrame.
  
      Uses HTML output if running inside Jupyter Notebook, otherwise
      formatted text output.
  
      Parameters
      ----------
      table : pd.Series or pd.DataFrame
          Table to pretty-print.
      name : str, optional
          Table name to display in upper left corner.
      fmt : str, optional
          Formatter to use for displaying table elements.
          E.g. '{0:.2f}%' for displaying 100 as '100.00%'.
          Restores original setting after displaying.