unpivot#

swordfish.function.unpivot()#

Convert the columns specified by valueColNames into a single column.

Parameters:
  • obj (Constant) – A table.

  • keyColNames (Constant) – A STRING scalar/vector indicating column name(s).

  • valueColNames (Constant) – A vector of column names. The specified columns will be converted into a single column. Note the values in these columns must have the same data type.

  • func (Constant, optional) – Indicate a function that is applied to valueColNames before they’re converted into one column, by default DFLT

Returns:

Return a table with columns arranged in the following order: the columns specified by keyColNames, the “valueType” column, and the “value” column:

  • The “valueType” column holds the results of func applied on the columns specified by valueColNames if func is specified, otherwise “valueType” holds the column names specified by valueColNames.

  • The “value” column holds the corresponding values of these columns.

Return type:

Constant