Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version r097

...

If you wish to maintain the original dataset values, you can apply an aggregate function within a single column.

Values to Columns

Similar to pivot, the Convert values to columns transformation converts individual values within a column to independent columns in the dataset. For each row, if the value represented by the column is present in the original data, one value is added (e.g. Yes). If it's missing, another value is inserted (e.g. No).

Tip

Tip: This type of conversion can be useful for preparing data for machine learning systems. You can convert the presence or absence of specific values in a row to 1 or 0, respectively.

In the following, the values in the Store_Nbr column have been converted to individual columns:

D trans
Typestep
p01NameColumn
p01ValueStore_Nbr
p02NameFill when present
p02ValueYes
p03NameFill when missing
p04Value250
p04NameMax number of columns to create
SearchTermConvert values to columns

In the above:

  • Fill when present identifies the string literal value to insert if the row contains the column's value (Yes).
  • Fill when missing identifies the string literal value to insert if the row does not contain the column's value (empty).
  • Max number of columns to create places a limit on the total number of columns that the application is permitted to create. In this case, the limit is set to 250 since the known number of stores is 250.

    Tip

    Tip: It's a good habit to set limits on the maximum number of columns to create. Data can become sparse or unwieldy if limits are not considered.

Results:

...

D s also
inCQLtrue
label((label = "structuring_tasks") OR (label = "column_ui") OR (label = "pivot"))