Table Reshaping
3 nodes
On this page 3
Pivot
FunctionA pivot table: a row per value of the Rows columns, a column per value of the Pivot column, and in each cell the Value column of the rows that fall there, summarized - the sales of each region by month, say.
Pivot -> Table
table: Table
rows: Text Array
pivot: Text
value: Text
aggregation: Aggregation
fill: TextTable Pivot(
Table table,
string[] rows,
string pivot,
string value,
Aggregation aggregation = Aggregation.Sum,
string fill = "")Parameters
| name | type | default | description |
|---|---|---|---|
| table | Table | — | The rows to pivot. |
| rows | Text Array | — | The columns whose values make the rows. |
| pivot | Text | — | The column whose values become the new columns. |
| value | Text | — | The column whose values fill the cells. |
| aggregation | Aggregation | Sum | How the values that fall in one cell become one. |
| fill | Text | — | What an empty cell holds; empty to leave it empty. |
Returns
| Table | Table |
Remarks
The new columns are in natural order of their values, and there can be at most 500 of them. A cell no row falls in is empty, or Fill when it is given.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Table Reshaping
- Package
- Data Analytics
Transpose
FunctionRows turned into columns and columns into rows. The first column of the result holds the original column names; the new columns are named from the Header column's values, or "Row 1", "Row 2" and so on. At most 1,000 rows.
Transpose(table: Table, header: Text) -> Table
Table Transpose(Table table, string header = "")
Parameters
| name | type | default | description |
|---|---|---|---|
| table | Table | — | The table to transpose. |
| header | Text | — | A column whose values name the new columns; empty to number them. |
Returns
| Table | Table |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Table Reshaping
- Package
- Data Analytics
Unpivot
FunctionColumns turned into rows - the opposite of a pivot, also called melt: each row becomes one row per value column, holding the ID columns, the value column's name and its value.
Unpivot -> Table
table: Table
IDs: Text Array
values: Text Array
nameColumn: Text
valueColumn: Text
skipEmpty: TruthTable Unpivot(
Table table,
string[] ids,
string[] values,
string nameColumn = "Attribute",
string valueColumn = "Value",
bool skipEmpty = true)Parameters
| name | type | default | description |
|---|---|---|---|
| table | Table | — | The wide table. |
| IDs | Text Array | — | The columns to keep on every row. |
| values | Text Array | — | The columns to turn into rows; every column but the IDs when empty. |
| nameColumn | Text | Attribute | The name of the column that says which column a value came from. |
| valueColumn | Text | Value | The name of the column the values go in. |
| skipEmpty | Truth | True | Whether to leave out rows whose value is empty. |
Returns
| Table | Table |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Table Reshaping
- Package
- Data Analytics