Partition List Predicate

../../../../_images/partition_list.svg
class node_filter_list.PartitionListPredicate[source]

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 when it returns True, then the element is written to the first output, otherwise it is written to the second output.

Examples (with table as the element type):

Remove tables with zero length columns:

lambda table: table.number_of_columns() > 0

Remove empty tables:

lambda table: not table.is_empty()

Partition a list using a predicate.

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

Partition function