Skip to main content
Keeps or drops rows with specific row numbers, i.e. based on their 0-based, consecutive integer index.

Usage

The following example shows how the step can be used in a recipe.

Examples

  • Example 1
  • Signature
To keep only rows with index 0, 2 and 4 (the first, third and fifth row)
filter_row_numbers(ds, {"row_numbers": [0, 2, 4]}) -> (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

row_numbers
array[integer]
required
Ids of the rows to filter. Excepts either a single row (as a number) or a list of row numbers.
Item
integer
Each item in array.
exclude
boolean
default:"false"
if true, selected rows will be excluded from the resulting dataset.
I