Group List

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

Group a list using a configured item-based key function.

Documentation

This node takes a key function from the configuration and uses it to decide how to group the items in the input list.

The key function is applied once for each input element in the list. All elements for which the key function returns the same value will end up in the same group.

Examples with port type == [table] and item type == table:

Put all tables with the same number of rows in the same group:

lambda item: item.number_of_rows()

Put empty tables in one group and nonempty tables in another group:

lambda item: 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.

Definition

Input ports

list

[<a>]

List of items

Output ports

lists

[[<a>]]

Grouped items

Configuration:
Predicate partition function (predicate)

Partition function

class node_filter_list.GroupList[source]

Related nodes

Example flows