Rename Column
This function is used to rename a specific column name in a dataset.
tags: [“Data Preparation”]
Parameters
The table gives a brief description about each parameter in Rename 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)
- Column:
The column name to be renamed in the dataset. (Required: True, Multiple: False, Datatypes: [‘ANY’], Options: [‘FIELDS’] , Datasets: [‘df’])
- New Name:
The new name of the column. (Required: True, Multiple: False, Datatypes: [‘STRING’], Options: [‘CONSTANT’])
- Output Dataset:
The file name with which the output dataset is created. This dataset is generated with a new column name. (Required: True, Multiple: False)
The sample input for this transform looks as shown in the screenshot:
The output after running the Rename column transform on the dataset appears as below:
How to use it in Notebook
The following is the code snippet you must use in the Jupyter Notebook editor to run the Rename transform:
template=TemplateV2.get_template_by('Rename Column')
recipe_Rename_Column= project.addRecipe([car_data, employee_data, temperature_data, only_numeric], name='Rename Column')
transform=Transform()
transform.templateId = template.id
transform.name='Rename Column'
transform.variables = {
'input_dataset':'car',
'column':"car_ID",
'new_column_name':"ID",
'output_dataset':'car_rename'}
recipe_Rename_Column.add_transform(transform)
recipe_Rename_Column.run()
Requirements
pandas