Round decimal places

This transform will round off all decimal values in the dataset up to the given decimal places.

tags: [“Data Preparation”]

Parameters

The table gives a brief description about each parameter in Replace with Dictionary 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 dataset is created. This file will have values rounded only to the given decimal places. (If the given decimals are 2, the transform will round the decimal values in every column to 2 decimal places (23.22, 45.89, and so on))(Required: True, Multiple: False)

decimals:

The number of decimal cases to round each field to (Required: True, Multiple: False, Datatypes: [“LONG”], Options: [“CONSTANT”])

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

../../../_images/decimal1.png

The output or result after adding the Round Decimal Place transform looks as below:

../../../_images/decimal2.png

How to use it in Notebook

The following is the code snippet you must use in the Jupyter Notebook editor to run the Round decimal places transform:

template=TemplateV2.get_template_by('Round decimal places')

recipe_Round_decimal_places= project.addRecipe([car_data, employee_data, temperature_data, only_numeric], name='Round decimal places')

transform=Transform()
transform.templateId = template.id
transform.name='Round decimal places'
transform.variables = {
'input_dataset':'car',
'output_dataset':'car_rounded',
'value_1':1}
recipe_Round_decimal_places.add_transform(transform)
recipe_Round_decimal_places.run()

Requirements

pandas