Workflow: Swapping rows and columns with the Transpose block
The Transpose block enables you to restructure a dataset to convert rows to columns.
The following demonstrates how the Transpose block is used to change the loandatasample.csv dataset (containing observations describing a loan and the person taking the loan out) structure such that each column represents an individual customer.
- Import the loandatasample.csv dataset onto a Workflow canvas using the Text File Import block.
- Expand the Data Preparation group in the Workflow palette, then click and drag a Transpose block onto the Workflow canvas.
- Click the Output port of the loandatasample dataset block and drag a connection towards the Input port of the Transpose block.
- Double-click the Transpose block to display the Configure Transpose dialog box.
- In the Configure Transpose dialog box:
- Click Select all to move all variables from the Unselected Transpose Variables box to the Selected Transpose Variables box.
- Click the Variable Names tab, in the Prefix text box, type Customer.
- Click OK to save the configuration and close the Configure Transpose dialog box.
A green execution status is displayed in the Output ports of the Transpose block and the new Working Dataset. The Transpose block output dataset is the transformed loandatasample dataset with each column representing a customer.