nodes: 0, module; 1, function_definition; 2, function_name:show_grid; 3, parameters; 4, block; 5, identifier:data_frame; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, if_statement; 14, if_statement; 15, if_statement; 16, if_statement; 17, if_statement; 18, if_statement; 19, comment:# if a Series is passed in, convert it to a DataFrame; 20, if_statement; 21, expression_statement; 22, comment:# create a visualization for the dataframe; 23, return_statement; 24, identifier:show_toolbar; 25, None; 26, identifier:precision; 27, None; 28, identifier:grid_options; 29, None; 30, identifier:column_options; 31, None; 32, identifier:column_definitions; 33, None; 34, identifier:row_edit_callback; 35, None; 36, comment:"""
      Renders a DataFrame or Series as an interactive qgrid, represented by
      an instance of the ``QgridWidget`` class.  The ``QgridWidget`` instance
      is constructed using the options passed in to this function.  The
      ``data_frame`` argument to this function is used as the ``df`` kwarg in
      call to the QgridWidget constructor, and the rest of the parameters
      are passed through as is.
  
      If the ``data_frame`` argument is a Series, it will be converted to a
      DataFrame before being passed in to the QgridWidget constructor as the
      ``df`` kwarg.
  
      :rtype: QgridWidget
  
      Parameters
      ----------
      data_frame : DataFrame
          The DataFrame that will be displayed by this instance of
          QgridWidget.
      grid_options : dict
          Options to use when creating the SlickGrid control (i.e. the
          interactive grid).  See the Notes section below for more information
          on the available options, as well as the default options that this
          widget uses.
      precision : integer
          The number of digits of precision to display for floating-point
          values.  If unset, we use the value of
          `pandas.get_option('display.precision')`.
      show_toolbar : bool
          Whether to show a toolbar with options for adding/removing rows.
          Adding/removing rows is an experimental feature which only works
          with DataFrames that have an integer index.
      column_options : dict
          Column options that are to be applied to every column. See the
          Notes section below for more information on the available options,
          as well as the default options that this widget uses.
      column_definitions : dict
          Column options that are to be applied to individual
          columns. The keys of the dict should be the column names, and each
          value should be the column options for a particular column,
          represented as a dict. The available options for each column are the
          same options that are available to be set for all columns via the
          ``column_options`` parameter. See the Notes section below for more
          information on those options.
      row_edit_callback : callable
          A callable that is called to determine whether a particular row
          should be editable or not. Its signature should be
          ``callable(row)``, where ``row`` is a dictionary which contains a
          particular row's values, keyed by column name. The callback should
          return True if the provided row should be editable, and False
          otherwise.
  
  
      Notes
      -----
      The following dictionary is used for ``grid_options`` if none are
      provided explicitly::
  
          {
              # SlickGrid options
              'fullWidthRows': True,
              'syncColumnCellResize': True,
              'forceFitColumns': True,
              'defaultColumnWidth': 150,
              'rowHeight': 28,
              'enableColumnReorder': False,
              'enableTextSelectionOnCells': True,
              'editable': True,
              'autoEdit': False,
              'explicitInitialization': True,
  
              # Qgrid options
              'maxVisibleRows': 15,
              'minVisibleRows': 8,
              'sortable': True,
              'filterable': True,
              'highlightSelectedCell': False,
              'highlightSelectedRow': True
          }
  
      The first group of options are SlickGrid "grid options" which are
      described in the `SlickGrid documentation
      <https://github.com/mleibman/SlickGrid/wiki/Grid-Options>`_.
  
      The second group of option are options that were added specifically
      for Qgrid and therefore are not documented in the SlickGrid documentation.
      The following bullet points describe these options.
  
      * **maxVisibleRows** The maximum number of rows that Qgrid will show.
      * **minVisibleRows** The minimum number of rows that Qgrid will show
      * **sortable** Whether the Qgrid instance will allow the user to sort
        columns by clicking the column headers. When this is set to ``False``,
        nothing will happen when users click the column headers.
      * **filterable** Whether the Qgrid instance will allow the user to filter
        the grid. When this is set to ``False`` the filter icons won't be shown
        for any columns.
      * **highlightSelectedCell** If you set this to True, the selected cell
        will be given a light blue border.
      * **highlightSelectedRow** If you set this to False, the light blue
        background that's shown by default for selected rows will be hidden.
  
      The following dictionary is used for ``column_options`` if none are
      provided explicitly::
  
          {
              # SlickGrid column options
              'defaultSortAsc': True,
              'maxWidth': None,
              'minWidth': 30,
              'resizable': True,
              'sortable': True,
              'toolTip': "",
              'width': None
  
              # Qgrid column options
              'editable': True,
          }
  
      The first group of options are SlickGrid "column options" which are
      described in the `SlickGrid documentation
      <https://github.com/mleibman/SlickGrid/wiki/Column-Options>`_.
  
      The ``editable`` option was added specifically for Qgrid and therefore is
      not documented in the SlickGrid documentation.  This option specifies
      whether a column should be editable or not.
  
      See Also
      --------
      set_defaults : Permanently set global defaults for the parameters
                     of ``show_grid``, with the exception of the ``data_frame``
                     and ``column_definitions`` parameters, since those
                     depend on the particular set of data being shown by an
                     instance, and therefore aren't parameters we would want
                     to set for all QgridWidet instances.
      set_grid_option : Permanently set global defaults for individual
                        grid options.  Does so by changing the defaults
                        that the ``show_grid`` method uses for the
                        ``grid_options`` parameter.
      QgridWidget : The widget class that is instantiated and returned by this
                    method.
  
      """; 37, comparison_operator:show_toolbar is None; 38, block; 39, comparison_operator:precision is None; 40, block; 41, not_operator; 42, block; 43, comparison_operator:column_options is None; 44, block; 45, else_clause; 46, comparison_operator:grid_options is None; 47, block; 48, else_clause; 49, not_operator; 50, block; 51, call; 52, block; 53, elif_clause; 54, assignment; 55, call; 56, identifier:show_toolbar; 57, None; 58, expression_statement; 59, identifier:precision; 60, None; 61, expression_statement; 62, call; 63, raise_statement; 64, identifier:column_options; 65, None; 66, expression_statement; 67, block; 68, identifier:grid_options; 69, None; 70, expression_statement; 71, block; 72, call; 73, raise_statement; 74, identifier:isinstance; 75, argument_list; 76, expression_statement; 77, not_operator; 78, block; 79, identifier:column_definitions; 80, parenthesized_expression; 81, identifier:QgridWidget; 82, argument_list; 83, assignment; 84, assignment; 85, identifier:isinstance; 86, argument_list; 87, call; 88, assignment; 89, expression_statement; 90, expression_statement; 91, expression_statement; 92, assignment; 93, expression_statement; 94, expression_statement; 95, expression_statement; 96, identifier:isinstance; 97, argument_list; 98, call; 99, identifier:data_frame; 100, attribute; 101, assignment; 102, call; 103, raise_statement; 104, boolean_operator; 105, keyword_argument; 106, keyword_argument; 107, keyword_argument; 108, keyword_argument; 109, keyword_argument; 110, keyword_argument; 111, keyword_argument; 112, identifier:show_toolbar; 113, attribute; 114, identifier:precision; 115, attribute; 116, identifier:precision; 117, identifier:Integral; 118, identifier:TypeError; 119, argument_list; 120, identifier:column_options; 121, attribute; 122, assignment; 123, call; 124, assignment; 125, identifier:grid_options; 126, attribute; 127, assignment; 128, call; 129, assignment; 130, identifier:grid_options; 131, identifier:dict; 132, identifier:TypeError; 133, argument_list; 134, identifier:pd; 135, identifier:Series; 136, identifier:data_frame; 137, call; 138, identifier:isinstance; 139, argument_list; 140, call; 141, identifier:column_definitions; 142, dictionary; 143, identifier:df; 144, identifier:data_frame; 145, identifier:precision; 146, identifier:precision; 147, identifier:grid_options; 148, identifier:grid_options; 149, identifier:column_options; 150, identifier:column_options; 151, identifier:column_definitions; 152, identifier:column_definitions; 153, identifier:row_edit_callback; 154, identifier:row_edit_callback; 155, identifier:show_toolbar; 156, identifier:show_toolbar; 157, identifier:defaults; 158, identifier:show_toolbar; 159, identifier:defaults; 160, identifier:precision; 161, binary_operator:"precision must be int, not %s" % type(precision); 162, identifier:defaults; 163, identifier:column_options; 164, identifier:options; 165, call; 166, attribute; 167, argument_list; 168, identifier:column_options; 169, identifier:options; 170, identifier:defaults; 171, identifier:grid_options; 172, identifier:options; 173, call; 174, attribute; 175, argument_list; 176, identifier:grid_options; 177, identifier:options; 178, binary_operator:"grid_options must be dict, not %s" % type(grid_options); 179, attribute; 180, argument_list; 181, identifier:data_frame; 182, attribute; 183, identifier:TypeError; 184, argument_list; 185, string:"precision must be int, not %s"; 186, call; 187, attribute; 188, argument_list; 189, identifier:options; 190, identifier:update; 191, identifier:column_options; 192, attribute; 193, argument_list; 194, identifier:options; 195, identifier:update; 196, identifier:grid_options; 197, string:"grid_options must be dict, not %s"; 198, call; 199, identifier:pd; 200, identifier:DataFrame; 201, identifier:data_frame; 202, identifier:pd; 203, identifier:DataFrame; 204, binary_operator:"data_frame must be DataFrame or Series, not %s" % type(data_frame); 205, identifier:type; 206, argument_list; 207, attribute; 208, identifier:copy; 209, attribute; 210, identifier:copy; 211, identifier:type; 212, argument_list; 213, string:"data_frame must be DataFrame or Series, not %s"; 214, call; 215, identifier:precision; 216, identifier:defaults; 217, identifier:column_options; 218, identifier:defaults; 219, identifier:grid_options; 220, identifier:grid_options; 221, identifier:type; 222, argument_list; 223, identifier:data_frame
code: def show_grid(data_frame,
                show_toolbar=None,
                precision=None,
                grid_options=None,
                column_options=None,
                column_definitions=None,
                row_edit_callback=None):
      """
      Renders a DataFrame or Series as an interactive qgrid, represented by
      an instance of the ``QgridWidget`` class.  The ``QgridWidget`` instance
      is constructed using the options passed in to this function.  The
      ``data_frame`` argument to this function is used as the ``df`` kwarg in
      call to the QgridWidget constructor, and the rest of the parameters
      are passed through as is.
  
      If the ``data_frame`` argument is a Series, it will be converted to a
      DataFrame before being passed in to the QgridWidget constructor as the
      ``df`` kwarg.
  
      :rtype: QgridWidget
  
      Parameters
      ----------
      data_frame : DataFrame
          The DataFrame that will be displayed by this instance of
          QgridWidget.
      grid_options : dict
          Options to use when creating the SlickGrid control (i.e. the
          interactive grid).  See the Notes section below for more information
          on the available options, as well as the default options that this
          widget uses.
      precision : integer
          The number of digits of precision to display for floating-point
          values.  If unset, we use the value of
          `pandas.get_option('display.precision')`.
      show_toolbar : bool
          Whether to show a toolbar with options for adding/removing rows.
          Adding/removing rows is an experimental feature which only works
          with DataFrames that have an integer index.
      column_options : dict
          Column options that are to be applied to every column. See the
          Notes section below for more information on the available options,
          as well as the default options that this widget uses.
      column_definitions : dict
          Column options that are to be applied to individual
          columns. The keys of the dict should be the column names, and each
          value should be the column options for a particular column,
          represented as a dict. The available options for each column are the
          same options that are available to be set for all columns via the
          ``column_options`` parameter. See the Notes section below for more
          information on those options.
      row_edit_callback : callable
          A callable that is called to determine whether a particular row
          should be editable or not. Its signature should be
          ``callable(row)``, where ``row`` is a dictionary which contains a
          particular row's values, keyed by column name. The callback should
          return True if the provided row should be editable, and False
          otherwise.
  
  
      Notes
      -----
      The following dictionary is used for ``grid_options`` if none are
      provided explicitly::
  
          {
              # SlickGrid options
              'fullWidthRows': True,
              'syncColumnCellResize': True,
              'forceFitColumns': True,
              'defaultColumnWidth': 150,
              'rowHeight': 28,
              'enableColumnReorder': False,
              'enableTextSelectionOnCells': True,
              'editable': True,
              'autoEdit': False,
              'explicitInitialization': True,
  
              # Qgrid options
              'maxVisibleRows': 15,
              'minVisibleRows': 8,
              'sortable': True,
              'filterable': True,
              'highlightSelectedCell': False,
              'highlightSelectedRow': True
          }
  
      The first group of options are SlickGrid "grid options" which are
      described in the `SlickGrid documentation
      <https://github.com/mleibman/SlickGrid/wiki/Grid-Options>`_.
  
      The second group of option are options that were added specifically
      for Qgrid and therefore are not documented in the SlickGrid documentation.
      The following bullet points describe these options.
  
      * **maxVisibleRows** The maximum number of rows that Qgrid will show.
      * **minVisibleRows** The minimum number of rows that Qgrid will show
      * **sortable** Whether the Qgrid instance will allow the user to sort
        columns by clicking the column headers. When this is set to ``False``,
        nothing will happen when users click the column headers.
      * **filterable** Whether the Qgrid instance will allow the user to filter
        the grid. When this is set to ``False`` the filter icons won't be shown
        for any columns.
      * **highlightSelectedCell** If you set this to True, the selected cell
        will be given a light blue border.
      * **highlightSelectedRow** If you set this to False, the light blue
        background that's shown by default for selected rows will be hidden.
  
      The following dictionary is used for ``column_options`` if none are
      provided explicitly::
  
          {
              # SlickGrid column options
              'defaultSortAsc': True,
              'maxWidth': None,
              'minWidth': 30,
              'resizable': True,
              'sortable': True,
              'toolTip': "",
              'width': None
  
              # Qgrid column options
              'editable': True,
          }
  
      The first group of options are SlickGrid "column options" which are
      described in the `SlickGrid documentation
      <https://github.com/mleibman/SlickGrid/wiki/Column-Options>`_.
  
      The ``editable`` option was added specifically for Qgrid and therefore is
      not documented in the SlickGrid documentation.  This option specifies
      whether a column should be editable or not.
  
      See Also
      --------
      set_defaults : Permanently set global defaults for the parameters
                     of ``show_grid``, with the exception of the ``data_frame``
                     and ``column_definitions`` parameters, since those
                     depend on the particular set of data being shown by an
                     instance, and therefore aren't parameters we would want
                     to set for all QgridWidet instances.
      set_grid_option : Permanently set global defaults for individual
                        grid options.  Does so by changing the defaults
                        that the ``show_grid`` method uses for the
                        ``grid_options`` parameter.
      QgridWidget : The widget class that is instantiated and returned by this
                    method.
  
      """
  
      if show_toolbar is None:
          show_toolbar = defaults.show_toolbar
      if precision is None:
          precision = defaults.precision
      if not isinstance(precision, Integral):
          raise TypeError("precision must be int, not %s" % type(precision))
      if column_options is None:
          column_options = defaults.column_options
      else:
          options = defaults.column_options.copy()
          options.update(column_options)
          column_options = options
      if grid_options is None:
          grid_options = defaults.grid_options
      else:
          options = defaults.grid_options.copy()
          options.update(grid_options)
          grid_options = options
      if not isinstance(grid_options, dict):
          raise TypeError(
              "grid_options must be dict, not %s" % type(grid_options)
          )
  
      # if a Series is passed in, convert it to a DataFrame
      if isinstance(data_frame, pd.Series):
          data_frame = pd.DataFrame(data_frame)
      elif not isinstance(data_frame, pd.DataFrame):
          raise TypeError(
              "data_frame must be DataFrame or Series, not %s" % type(data_frame)
          )
  
      column_definitions = (column_definitions or {})
  
      # create a visualization for the dataframe
      return QgridWidget(df=data_frame, precision=precision,
                         grid_options=grid_options,
                         column_options=column_options,
                         column_definitions=column_definitions,
                         row_edit_callback=row_edit_callback,
                         show_toolbar=show_toolbar)