Stack

The stack operation pivots a wide-format dataset into a long-format dataset by converting column headers into row values in a new column.

Example
Dataset:
Country | Population | GDP |
---|---|---|
USA | 330000000 | 21000000 |
China | 1400000000 | 15000000 |
India | 1350000000 | 3000000 |
Stack the dataset:
Country | Attribute | Value |
---|---|---|
USA | Population | 330000000 |
USA | GDP | 21000000 |
China | Population | 1400000000 |
China | GDP | 15000000 |
India | Population | 1350000000 |
India | GDP | 3000000 |
Updated 5 months ago