Table.transpose
transposekey_columns attribute_column_namevalue_column_nameerror_on_missing_columnson_problems
Group: Calculations
Aliases: pivot
, unpivot
Documentation
Returns a new table with a chosen subset of columns left unchanged and the other columns pivoted to rows with a single name field and a single value field.
Arguments
key_columns
: Set of fields to remain as columns. These values will be repeated for each data field that is pivoted.attribute_column_name
: The name of the field that will contain the names of the pivoted fields. If this name is already in use, it will be renamed with a numeric suffix.value_column_name
: The name of the field that will contain the values of the pivoted fields. If this name is already in use, it will be renamed with a numeric suffix.on_problems
: Specifies how to handle problems if they occur, reporting them as warnings by default.
Examples
Transpose Operation
Input Table table
:
Id | Name | Country
----|---------|---------
A | Example | France
B | Another | Germany
Result table.transpose ['Id'] 'Attribute' 'Value'
:
Id | Attribute | Value
----|-----------|---------
A | Name | Example
A | Country | France
B | Name | Another
B | Country | Germany
Errors
- If there are no columns in the output table, a
No_Output_Columns
is raised as an error regardless of the problem behavior, because it is not possible to create a table without any columns. - If a column in
columns
is not in the input table, aMissing_Input_Columns
is raised as an error, unlesserror_on_missing_columns
is set toFalse
, in which case the problem is reported according to theon_problems
setting. - If any column names in the new table are clashing, a
Duplicate_Output_Column_Names
is reported according to theon_problems
setting.