Rank By

This transform applies ranking for the entire dataset. The string values are ranked alphabetically.

tags: [“EDA”]

Parameters

The table gives a brief description about each parameter in Pop 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 file has ranking for all columns. (Required: True, Multiple: False)

axis:

It is set to either 0 or 1. 0 is for rows and 1 for columns. (Required: False, Multiple: False, Datatypes: [“LONG”] , Options: [“CONSTANT”], Constant_options: [0,1])

method:

The method used to rank the group of records having the same value. Possible methods:

  • average - Average rank of the group.

  • min - Lowest rank in the group.

  • max - Highest rank in the group.

  • first - Rank either in the ascending or descending order.

  • dense - Works like min, but rank is increased by 1 across groups.

(“average”, “min”, “max”, “first”, “dense”) (Required: False, Multiple: False, Datatypes: [“STRING”], Options: [“CONSTANT”], Constant_options: [‘average’, ‘min’, ‘max’, ‘first’, ‘dense’])

ascending:

Indicates whether the elements are sorted in ascending order or not. 1 for ascending and 0 for descending. (Required: False, Multiple: False, Datatypes: [“LONG”] , Options: [“CONSTANT”], Constant_options: [0,1])

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

../../../_images/rankby_input.png

The output after running the Rank By transform on the dataset appears as below:

../../../_images/rankby_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 Rank By transform:

template=TemplateV2.get_template_by('Rank By')

recipe_Rank_By= project.addRecipe([car_data, employee_data, temperature_data, only_numeric], name='Rank By')

transform=Transform()
transform.templateId = template.id
transform.name='Rank By'
transform.variables = {
'input_dataset':'car',
'output_dataset':'car_ranked',
'value_1':0,
'value_2':"average",
'value_3':0}
recipe_Rank_By.add_transform(transform)
recipe_Rank_By.run()

Requirements

pandas