Get Dummies

This transform creates new columns for each unique value in the categorical variable and assigns 0 or 1 to each column to indicate whether a particular value is present in the original dataset.

tags: [“Data Preparation”]

Parameters

This table provides a brief description about each parameter in Get Dummies 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 file contains new columns for each unique value in the categorical variable. (Required: True, Multiple: False)

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

../../../_images/getdummies_input.png

The output after running the Get Dummies transform on the dataset appears as below:

Projects/templates_docs/templates_UI_images/getdummies_output.png

How to use it in Notebook

The following is the code snippet you must use in the Jupyter Notebook editor to run the Get Dummies transform:

template=TemplateV2.get_template_by('Get Dummies')

recipe_Get_Dummies= project.addRecipe([car_data, employee_data, temperature_data, only_numeric], name='Get Dummies')

transform=Transform()
transform.templateId = template.id
transform.name='Get Dummies'
transform.variables = {
'input_dataset':'car',
'output_dataset':'car_getdummies'}
recipe_Get_Dummies.add_transform(transform)
recipe_Get_Dummies.run()

Requirements

pandas