Sample of a Column

This transform generates the sample for a column for the specified number of rows by picking the rows randomly from the column.

tags: [“EDA”]

Parameters

The table gives a brief description about each parameter in Sample of a 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 is created with a sample of the given column (Required: True, Multiple: False)

Column:

The column from which the specified number of rows should be selected randomly. (Required: True, Multiple: False, Datatypes: [“STRING”], Options: [“FIELDS”], Datasets: [“df”])

Lenght of the sample:

The length or number of rows to be returned as a sample from the given column. (Required: True, Multiple: False, Datatypes: [“LONG”], Options: [‘CONSTANT’])

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

../../../_images/sampleofacolumn_input.png

The output or result after executing the Sample of a Column transform looks as below:

../../../_images/sampleofacolumn_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 Sample of a Column transform:

template=TemplateV2.get_template_by('Sample of a Column')

recipe_Sample_of_a_Column= project.addRecipe([car_data, employee_data, temperature_data, only_numeric], name='Sample of a Column')

transform=Transform()
transform.templateId = template.id
transform.name='Sample of a Column'
transform.variables = {
'input_dataset':'car',
'output_dataset':'sample_car_col',
'col1':"fueltype",
'n1':4}
recipe_Sample_of_a_Column.add_transform(transform)
recipe_Sample_of_a_Column.run()

Requirements

pandas