Unstack
In this document, you’ll learn how to use the Unstack transformation in Astera Dataprep to convert values from a single column into multiple columns, making it easier to compare data side by side.
Suppose you have a dataset containing education-related statistics for multiple countries, with columns for Country, ISO_Code, Year, and LAYS. Each country has separate rows for different years. For example, 2017, 2018, and 2020.
To unstack data in Astera Dataprep, click on the Transform option in the toolbar and select Unstack from the drop-down.

Once selected, the Recipe Configuration – Unstack panel will open.

Group Count: Check this option if you manually define the number of input groups in your dataset.
Number of Input Groups: The number of times your repeating values appear for each unique Key.
Unstack Options:
Key: Columns that uniquely identify each record (e.g., Country, ISO_Code).
Input: Columns that hold the values you want to unstack (e.g., LAYS).
Example: Setting number of input groups to 3 (for years 2017, 2018, and 2020) with Country and ISO_Code as Key and LAYS as Input will unstack values into three new columns (LAYS1, LAYS2, LAYS3).

Pivot: Check this option when you want to unstack data based on a category or driver values (e.g., Year), creating separate columns for each value.

Unstack Options:
Key: Columns that uniquely identify each record (e.g., Country, ISO_Code).
Input: Columns that hold the values you want to unstack (e.g., LAYS).
Pivot: Column containing categories or drivers (e.g., Year).
Driver Values: You also need to provide the driver values (e.g., 2017, 2018, 2020). These can be entered manually or fetched using Auto Fill.
Once you are done with your configurations, click
Apply.
Example: Setting Country and ISO_Code as Key, LAYS as Input, and Year as Pivot with driver values 2017, 2018, 2020 will generate separate columns named LAYS_2017, LAYS_2018, and LAYS_2020.


Last updated
Was this helpful?