Skip to main content
Keeps or drops rows where numeric values fall within a desired range, i.e. are greater than a certain minimum, and/or smaller than a maximum value.

Usage

The following examples show how the step can be used in a recipe.

Examples

  • Example 1
  • Example 2
  • Signature
The following example creates a new dataset including only those rows whose satisfaction_level is between 0.6 and 0.9 (inclusive).
filter_range(ds, {"column": "satisfaction_level", "min": 0.6, "max": 0.9}) -> (ds_filtered)

Inputs & Outputs

The following are the inputs expected by the step and the outputs it produces. These are generally columns (ds.first_name), datasets (ds or ds[["first_name", "last_name"]]) or models (referenced by name e.g. "churn-clf").
ds_in
dataset
required
An input dataset to filter.
ds_out
dataset
required
A new dataset containing the same columns as the input dataset but only those rows passing the filter condition.

Configuration

The following parameters can be used to configure the behaviour of the step by including them in a json object as the last “input” to the step, i.e. step(..., {"param": "value", ...}) -> (output).

Parameters

column
string (ds_in.column:number)
required
Name of the column to apply the filter to.
exclude
boolean
default:"false"
If true, values within the specified range will be excluded from the resulting dataset.
max
number
Maximum value in the selected column to pass the filter (to be included). Either this or the min parameter must be specified.
min
number
Minimum value in the selected column to pass the filter (to be included). Either this or the max parameter must be specified.
I