Altair SmartWorks Analytics

 

Unpivoting Columns

The Unpivot node transforms a short/wide table into a tall/skinny one by distributing columns into rows.

Prerequisite

  • An Execution Profile with an active session linked to the workflow

Steps

  1. Produce a Data Frame node by importing a CSV or database table.

  2. From the Data Preparation group of  the Nodes tabbed page, drag and drop the Unpivot node from the Palette to the Workflow Canvas. The Unpivot node has one input socket and one output socket. Connect the output socket of the Data Frame node to the input socket of the Unpivot node.

  3. Configure the Unpivot node by opening the Node Viewer. You can double-click on the node or use the Open option provided in the node menu. 

  4. In the Configuration tab, specify the following details to configure the Unpivot node.

  5. unpivot_config

     

    Property

    Description

    Output properties

    Specify the output table for the Unpivot node.

    Unpivot settings

    Enter values for Attribute and Value Column names. (Transforms the selected columns into attribute-value pairs where columns become rows.)

    Unpivot columns 

    Click the   icon next to the column name to add the column for unpivoting from the Columns to include section or to manually remove the selected column from the unpivoted columns. 

    Alternatively, select a Bulk Action (Select All, Unselect All) from the list.

    • Select All - Selects all columns for unpivoting.

    • Unselect All - Unselects all columns selected for unpivoting.

    Columns to include

    Click the  icon next to the column name to add multiple columns for unpivoting.

    Included column names

    Select the prefix or suffix for column names to be included in the unpivot. 

     

  6. Check the code that will be executed for your specified Unpivot configuration by saving your current configuration and then clicking on the Code tab of the Unpivot Node Viewer. You can use the Code Editor to refine the code further.

  7.  

  8. Complete the Unpivot Node configuration by clicking Save. To cancel your changes and return to the Workflow Canvas, press Discard or simply close the Unpivot Node Viewer. To execute the unpivot operation, click the Run button.