Transpose Table

../../../../../_images/pivot_table.svg

This node performs a standard transpose of tables. Bear in mind, since a column can only contain one type, if the rows contain different types the transposed columns will be converted to the closest matching type. The worst case is therefore strings.

An exception to this behaviour is when the first column contains strings. Using the option ‘Use selected column as column names’ the selected column will replace the column names in the new table. The rest of the input table will be transposed, discarding the name column.

The other option is ‘Column names as first column’ which will take the table’s column names and put them in the first column in the output table. This is convenient if you simply want to extract column names from a table.

When the columns transposed have different types, the node will try to find a result type to accommodate the new values. For example, combining an integer and a boolean would result in an integer column with the boolean values translated from False to 0 and True to 1. LIMITATION: If the types differ and part of the column is date-time or time-delta no resulting type can be found.

Input ports:
input:

table

The Table to transpose

Output ports:
output:

table

The transposed Table

Configuration:
Column names as first column (use_col_names)
Set column names from the input table as the first column in the transposed table
Use selected column as column names (reverse_col_names)
Use the selected column from input table as column names in the transposed table, and discarding the selected column from the transpose.
Column names column (columns)
Column that contains the new column names
class node_pivot_table.TransposeTableNew[source]