Create a New Column

General information

Brick provides a possibility to create new features by creating a new column.

Description

Brick Location

Bricks Data ManipulationConvert/Replace → Create New Column

Brick Parameters

  • Setting
    • One of the options available in the drop-down menu: 'Add a flat value', 'Add a function output', 'Add a list of values as a new column', and 'Add an empty column'.
  • Value1
    • Text input field. This field is obligatory for setting = 'Add a flat value' only.
  • Function
    • List of possible functions to apply. Additional parameter required for a setting = 'Add a function output' only.
  • List of values
    • Text input field. Additional parameter required for a setting = 'Add a list of values as a new column' only.
  • Separator
    • Text input field. Additional parameter required for a setting = 'Add a list of values as a new column' only.
  • New Column Name
    • Input field. This field is obligatory for any setting selected.

Brick Inputs/Outputs

  • Inputs
    • Brick takes the dataset (optionally in case of setting='Add a list of values as a new column').
  • Outputs
    • Brick produces the result as an extended input dataset with one additional column called as specified in the parameter "New Column Name" or a dataset with only one column in case of setting='Add a list of values as a new column'.

Description

You should use this brick when there is a need to create an additional column. There are several options available on how a new column is going to be created.

Example of usage

You should select one setting from the drop-down brick menu. Depending on the selected setting and the input data, an additional column would be added to the output dataset. The following options are available:

Add a flat value

Mandatory inputs:
  1. Value to populate column with
  1. New column name
    1. Example: added column Year populated with value of 2020
notion image

Add a function output

Mandatory inputs:
  1. New column name
  1. One function from the following:
      • Range numerates rows starting from 0
        • Example:
          notion image
           
      • Random integer (from and to) assigns each row random integer value from the input interval
        • Example: random integer (from 1 to 100)
          notion image
           
      • Random float (from and to) assigns each row random float value from the input interval
        • Example: random float (from 1 to 10)
          notion image
           
      • Random value from the list assigns each row random value from the input list
        • Example: random value from the list "one, two, three, four, five", with comma separator
          notion image
       

Add a list of values as a new column

Mandatory inputs:
  1. List of values
  1. Separator
  1. New column name
Example1: add list of values "one, two, three, four" to the input data1 as a new column
notion image
Example2: add list of values "one, two, three, four" as a column in the new dataset
notion image

Add an empty column

Mandatory inputs:
  1. New column name
Example: added empty column
notion image