New Constant Column

This transform adds a new column with the same constant value to every row in this column.

tags: [“Data Preparation”]

Parameters

The table gives a brief description about each parameter in New Constant Column transform.

Name:

By default, the transform name is populated. You can also add a custom name for the transform.

Input Dataset:

The file name of the input dataset. You can select the dataset that was uploaded from the drop-down list. (Required: True, Multiple: False)

Output Dataset:

The file name with which the output dataset is created. This contains a new column with the constant value. (Required: True, Multiple: False)

value_1:

The name of the column to be added to the input dataset. Required:* True, Multiple: False, Datatypes: [‘ANY’], Options: [“CONSTANT”])

value_2:

The constant value to be displayed in each row of the new column. (Required: True, Multiple: False, Datatypes: [‘ANY’], Options: [“CONSTANT”])

The sample input for this transform looks as shown in the screenshot.

../../../_images/newconstantcol_input.png

The output after running the New Constant Column transform on the dataset appears as below:

../../../_images/constantcol_output.png

How to use it in Notebook

template=TemplateV2.get_template_by('New Constant Column')

recipe_New_Constant_Column= project.addRecipe([car_data, employee_data, temperature_data, only_numeric], name='New Constant Column')

transform=Transform()
transform.templateId = template.id
transform.name='New Constant Column'
transform.variables = {
'input_dataset':'car',
'output_dataset':'car_newColumn',
'value_1':"A",
'value_2':"A"}
recipe_New_Constant_Column.add_transform(transform)
recipe_New_Constant_Column.run()

Requirements

pandas