Supported in: Batch, Faster, Streaming
Unpivot is the opposite operation of pivot. This converts multiple columns into rows, transforming data from a wide format to a long format. To do so it creates two new columns: one containing the original column names as values, and another containing the corresponding data values. Columns selected for unpivot have their values included even when their names match an output column name. Other columns are kept as is unless their names match an output column name, in which case they are replaced by the output column.
Transform categories: Aggregate, Popular
Type variable bounds: T accepts AnyType
Argument values:
new_york_miles, london_miles]Input:
| airline | new_york_miles | london_miles |
|---|---|---|
| foundry airways | 1000 | 6000 |
| new air | null | 8000 |
Output:
| city | miles | airline |
|---|---|---|
| new_york_miles | 1000 | foundry airways |
| london_miles | 6000 | foundry airways |
| new_york_miles | null | new air |
| london_miles | 8000 | new air |
Argument values:
new_york_miles, london_miles]Input:
| airline | new_york_miles | london_miles | miles |
|---|---|---|---|
| foundry airways | 1000 | 6000 | 0 |
| new air | null | 8000 | 0 |
Output:
| city | miles | airline |
|---|---|---|
| new_york_miles | 1000 | foundry airways |
| london_miles | 6000 | foundry airways |
| new_york_miles | null | new air |
| london_miles | 8000 | new air |