N Largest Values

This transform returns the first n largest values of a specific column in the descending order, from a dataset.

tags: [“EDA”]

Parameters

The table gives a brief description about each parameter in N Largest Values 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 the dataset with the given number of largest values sorted in the descending order. (Required: True, Multiple: False)

n:

The total number of largest numbers to be returned after sorting by the highest value for a particular column. (Required: True, Multiple: False, Datatypes: [“LONG”], Options: [“CONSTANT”])

columns:

The name of the column to which the nth largest transform must be applied. (Required: True, Multiple: True, Datatypes: [‘ANY’], Options: [“FIELDS”], Datasets: [“df”])

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

../../../_images/nlargestvalue_input.png

The output after running the N Largest Values transform on the dataset appears as below:

../../../_images/nlargestvalue_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 N Largest Values transform:

template=TemplateV2.get_template_by('N Largest Values')

recipe_N_Largest_Values= project.addRecipe([car_data, employee_data, temperature_data, only_numeric], name='N Largest Values')

transform=Transform()
transform.templateId = template.id
transform.name='N Largest Values'
transform.variables = {
'input_dataset':'car',
'output_dataset':'car_nlargest',
'value_1':1,
'value_2':"carlength"}
recipe_N_Largest_Values.add_transform(transform)
recipe_N_Largest_Values.run()

Requirements

pandas