Select rows in Table¶
Reduction of rows in Table according to specified filter.
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, the constraint value will be read as a value of the same type as the column it is compared to. For information about how to enter text, see Input typed values as text. Alternatively a custom filter function can be used.
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 considered to fail the constraint check. In other words they are never included in the output. Custom filter functions can override this behavior.
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.
If the custom filter returns a masked array, masked values are treated as False (i.e. such rows are not included in the output).
- Columns to filter (columns)
Select columns for comparison relation
- Constraint must be satisfied in (exist)
Constraint must be satisfied in: Any selected column or All selected columns.
- Relation (relation)
Select comparison operator for relation
- Filter constraint (constraint)
Specify constraint value for comparison relation
- Use custom filter (use_custom_predicate)
Select to use custom filter
- Custom filter (predicate)
Write a custom filter as a Python lambda function
- Preview rows (limit)
Rows to display