Filter rows in Table¶
Filter column using Tables.
Documentation
Filter the rows of Value table producing a subset as the output Filtered table.
Filtering takes place according to a comparison relation between the elements of two chosen columns. One of the column, Value, chosen from the Value table that will be filtered while the other, Reference, is chosen from the Reference table.
The comparison relation can also be defined as a lambda function in the configuration GUI or one of the predefined relations can be used.
- The predefined relations are the following:
- In
keeps the row from Value table if the chosen Value column is also present anywhere in the Reference column.
- Not in
keeps the row from Value table if the chosen Value column is not present anywhere in the Reference column.
Alternatively, a custom filter function can be defined by writing a lambda function. The lambda function will be called once for each item in the selected Value column with the full Reference column available under the name ref (or C0). The lambda function should return True or False.
See https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions for a description of lambda functions. Have a look at the Table API to see all the available methods and attributes.
Warning
The labels of this node has changed. The columns Reference, Value used to be called C0, C1 respectively. This can be good to keep in mind if you are used to the old names.
Definition
Input ports
- port0
table
Reference Table
- port1
table
Value Table
Output ports
- port0
table
Filtered Table
- Configuration:
- Reference (c0_column)
Select the column in Reference Table, to use as reference column in the comparison.
- Value (c1_column)
Select the column in Value Table, to compare with the reference column.
- Operator (filter_functions)
Output Value rows where
- Use custom filter function (use_custom_predicate)
Use a custom filter (predicate) function to filter.
- Custom filter (predicate_function)
The predicate function to use when filtering.
-
class
node_table_filter.
ColumnFilterNode
[source]
Related nodes
Example flows