Partition List Predicate¶
Partition nodes with predicate takes a configurable predicate function (a function that returns True or False) from the configuration and uses it to decide how to partition the output.
The function is applied for each input element in the list. If it returns True, then the element is written to the first output, otherwise it is written to the second output.
Examples with port type == [table] and item type == table:
Remove tables with less than 10 rows:
lambda item: item.number_of_rows() > 10Remove empty tables:
lambda item: not item.is_empty()
The name of the argument is not important.
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.
Partition a list using a predicate.
Ports:
Inputs:
list: [<a>]
List
Outputs:
list_true: [<a>]
List of items where predicate returned true
list_false: [<a>]
List of items where predicate returned false
Configuration:
- predicate
- Partition function