Select rows in Table

../../../../../_images/select_table_rows.svg
class node_select_table_rows.SelectTableRows

Select rows in Tables by applying a constraint to a number of columns in the incoming Table. The output Table has the selected rows from incoming Table with order preserved. The number of rows in the output is therefore always less than or equal to the number of rows in the input. The number of columns is the same.

The constraint can be defined by selecting a comparison operator in the drop down menu and a entering a constraint value in the text field or by entering a custom filter function.

The constraint will be applied for each selected column. The results per column are then combined using the selected reduction method. If set to ‘all’ (the default) the constraint needs to be True in all selected column for a row to be included in the output. If set to ‘any’ it is enough that the constraint is True for any single selected column. When only one column is selected this option has no effect.

Rows where any of the selected columns are masked are never included in the output when not using a custom filter.

A custom filter function can be defined by writing a lambda function. The lambda function will be called once for each selected column with that column as a numpy array as argument. The lambda function should return an array-like object (e.g. numpy.ndarray or pandas.Series) with boolean dtype and as many items as there was in the argument.

See https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions for a description of lambda functions. Have a look at the Data type APIs to see what methods and attributes are available on the data type that you are working with.

Rows where the custom filter that returns a masked array; the rows where the custom filter is masked will not be included from the output.

Ref. nodes:

Select rows in Table with Table, Slice data Table, Filter rows in Table

Inputs:
Input : table

Input

Outputs:
Output : table

Output

Configuration:
Columns to filter

Select columns for comparison relation

Constraint must be satisfied in

Constraint must be satisfied in: Any selected column or All selected columns.

Relation

Select comparison operator for relation

Filter constraint

Specify constraint value for comparison relation

Use custom filter

Select to use custom filter

Custom filter

Write a custom filter as a Python lambda function

Preview rows

Rows to display