code: def table(ax, data, rowLabels=None, colLabels=None, **kwargs):
      """
      Helper function to convert DataFrame and Series to matplotlib.table
  
      Parameters
      ----------
      ax : Matplotlib axes object
      data : DataFrame or Series
          data for table contents
      kwargs : keywords, optional
          keyword arguments which passed to matplotlib.table.table.
          If `rowLabels` or `colLabels` is not specified, data index or column
          name will be used.
  
      Returns
      -------
      matplotlib table object
      """
      if isinstance(data, ABCSeries):
          data = data.to_frame()
      elif isinstance(data, ABCDataFrame):
          pass
      else:
          raise ValueError("Input data must be DataFrame or Series")
  
      if rowLabels is None:
          rowLabels = data.index
  
      if colLabels is None:
          colLabels = data.columns
  
      cellText = data.values
  
      import matplotlib.table
  
      table = matplotlib.table.table(
          ax,
          cellText=cellText,
          rowLabels=rowLabels,
          colLabels=colLabels,
          **kwargs,
      )
      return table
  
file_path: catboost/contrib/python/pandas/py2/pandas/plotting/_tools.py
imports: from __future__ import division
  from math import ceil
  import warnings
  import numpy
  from pandas.compat import range
  from pandas.core.dtypes.common import is_list_like
  from pandas.core.dtypes.generic import ABCDataFrame, ABCIndexClass, ABCSeries
label_desc: Use image node_id 2 for calling a global function with example usage: table(ax, data, rowLabels, colLabels) and returns: table