code: def print_table(
      table,
      name=None,
      float_format=None,
      formatters=None,
      header_rows=None,
  ):
      """
      Pretty print a pandas DataFrame.
  
      Uses HTML output if running inside Jupyter Notebook, otherwise
      formatted text output.
  
      Parameters
      ----------
      table : pandas.Series or pandas.DataFrame
          Table to pretty-print.
      name : str, optional
          Table name to display in upper left corner.
      float_format : function, optional
          Formatter to use for displaying table elements, passed as the
          `float_format` arg to pd.Dataframe.to_html.
          E.g. `'{0:.2%}'.format` for displaying 100 as '100.00%'.
      formatters : list or dict, optional
          Formatters to use by column, passed as the `formatters` arg to
          pd.Dataframe.to_html.
      header_rows : dict, optional
          Extra rows to display at the top of the table.
      """
  
      if isinstance(table, pd.Series):
          table = pd.DataFrame(table)
  
      if name is not None:
          table.columns.name = name
  
      html = table.to_html(
          float_format=float_format, formatters=formatters
      )
  
      if header_rows is not None:
          # Count the number of columns for the text to span
          n_cols = (
              html.split("<thead>")[1]
              .split("</thead>")[0]
              .count("<th>")
          )
  
          # Generate the HTML for the extra rows
          rows = ""
          for name, value in header_rows.items():
              rows += (
                  '\n    <tr style="text-align: right;"><th>%s</th>'
                  + "<td colspan=%d>%s</td></tr>"
              ) % (name, n_cols, value)
  
          # Inject the new HTML
          html = html.replace("<thead>", "<thead>" + rows)
  
      display(HTML(html))
  
imports: from __future__ import division
  import warnings
  from itertools import cycle
  from matplotlib.pyplot import cm
  import numpy
  import pandas
  from IPython.display import display, HTML
  import empyrical.utils
  from .None import pos
  from .None import txn
label_desc: Use image node_id 7 for calling a global function with example usage: print_table(table, name, float_format, formatters, header_rows) without return types