Concept | Pivot recipe¶
The Pivot recipe transforms datasets into pivot tables, which are tables of summary statistics. This operation can also be referred to as reshaping from long to wide format.
In the following example, we will use a Pivot recipe to extract some useful statistics from a table of retail transactions. Specifically, we want to calculate the total number of items purchased as well as the most recent year of purchase for each customer.
To do this, we’ll need to configure the Pivot recipe.
There are three main components of the Pivot recipe:
Pivot, which determines the reshaping of a dataset into a pivot table. Specifically, we decide which rows we want to transform into columns.
Group keys (or row identifiers), which determine the rows of a pivot table.
Aggregations to indicate which columns contains values that we want to aggregate.
In our example, we:
Select to pivot by the item column.
Choose to use the name column as the group key.
Tell Dataiku to compute aggregations for the quantity and year columns.