0 / 0
Pivot table widgets in Decision Optimization experiments
Last updated: Apr 05, 2024
Pivot table widgets in Decision Optimization experiments

You can add pivot tables in the Visualization view to display data from an existing (input or output) table aggregated in different ways.

To show data aggregated, select the table columns and rows that you want to display and select the appropriate aggregator to compute the data for each cell.

For example, the JSON code that is generated for a pivot table is as follows:
{
  "name": "",
  "type": "Pivot",
  "props": {
    "container": "Pivot2",
    "data": "party",
    "spec": {
      "config": {},
      "columns": [
        {
          "property": "Party Size",
          "label": "Party Size",
          "type": "Number",
          "visible": true,
          "width": 0,
          "style": {}
        }
      ],
      "rows": [
        {
          "property": "Payer Gender",
          "label": "Payer Gender",
          "type": "String",
          "visible": true,
          "width": 0,
          "style": {}
        },
        {
          "property": "Day of Week",
          "label": "Day of Week",
          "type": "String",
          "visible": true,
          "width": 0,
          "style": {}
        }
      ],
      "tableRenderer": "Table Row Heatmap",
      "aggregator": "Count Unique Values",
      "aggregatedCol1": "Tip"
    },
    "search": ""
  }
}
Table 1. Pivot-table widget specifications
Field Description
name The name of the widget
type Pivot
container The selected scenario
data The name of the existing table to pivot
columns An array of columns of the existing table that are used as pivot column headers
rows An array of rows of the existing table that are used as pivot rows headers
tableRenderer The type of table rendered. Choose from these options Table, Table Heatmap, Table Col Heatmap, and Table Row Heatmap
aggregator The function that computes the cells from the chosen columns and rows. Several choices are available:Count, Count Unique Values, List Unique Value, Sum, Integer Sum, Average, Median, Sample variance, Sample Standard Deviation, Minimum, Maximum, First, Last, Sum over Sum, Sum as Fraction of Total, Sum as Fraction of Rows, Sum as Fraction of Columns, Count as Fraction of Total, Count as Fraction of Rows, Count as Fraction of Columns

aggregatedCol1

aggregatedCol2

The name of the columns needed for those aggregators that require table columns to aggregate the data.Count aggregators require no such column name. The Sum over Sum aggregator requires 2 columns, and all other aggregators require one column.
Generative AI search and answer
These answers are generated by a large language model in watsonx.ai based on content from the product documentation. Learn more