unpivot#

swordfish.function.unpivot()#

Convert the columns specified by valueColNames into a single column.

参数:
  • 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

返回:

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.

返回类型:

Constant