Partition List Predicate

../../../../_images/partition_list.svg

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() > 10

Remove 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.

Input ports:
list:

[<a>]

List

Output ports:
list_true:

[<a>]

List of items where predicate returned true

list_false:

[<a>]

List of items where predicate returned false

Configuration:
Predicate partition function (predicate)
Partition function
class node_filter_list.PartitionListPredicate[source]

Example flows