KitDocumentation

ColumnAdd

Adds a new column to the dataframe. A new column is added containing the values from one of the following:
- An empty column, but you provide the column name
- A column with the same value for each row
- A column whose value is set by a list variable

Options

newColumnNames: Specifies the name of the new column being added to the dataframe
variable: Specifies a variable to use as the value of the new dataframe

Examples

Example 1 - Add a New Empty Column

Add an empty column to a dataframe that has a desired column name. Specify the desired column name with the
#> ColumnAdd --newColumnNames NewEmptyColumn
AFLEFT 
bankTransactionsDf['NewEmptyColumn'] = pd.Series() AFRIGHT

Example 2 - Added a Column With Set Value

Add a column to the dataframe where every row in the column has the same value. In this case, the column name is Columnof1s and the value of each row for the column will be 1
#> ColumnAdd 1 --newColumnNames Columnof1s
AFLEFT 
bankTransactionsDf['Columnof1s'] = 1 AFRIGHT

Example 3 - Adding a Variable as a Column

Add a variable as a column to the dataframe. If a column name is not provided, the column name will be the same as the variable name. Here, the variable location is added to the dataframe as a new column names location.
#> ColumnAdd location
AFLEFT 
bankTransactionsDf['location'] = location AFRIGHT