GroupByKey
Groups a list of values by a corresponding list of keys
Overview
Groups a list of values by a corresponding list of keys
Inputs (2)
- Keys (Generic): Keys to group by
- List (Generic): List of values to be grouped (must be same length as Keys)
Outputs (2)
- Unique Keys (Generic): List of unique keys
- Grouped Values (Generic): Data tree with values grouped by keys
Method, assumptions and simplifications
The same notes appear in the component's Info output.
Method
- Walks Keys and List together; each new key (compared by its plain value, so text A and A match) opens a new group in order of first appearance. A single list gives paths 0, 1, 2...; with several input branches, groups are written to (input path; group index). Null keys form their own group (null in Unique Keys).
- Each value goes into its key's branch; Unique Keys lists the keys in the same order.
Assumptions
- Keys and List have the same length (otherwise error).
Simplifications and limits
- Numbers are compared exactly (1.0 and 1.0000001 are different keys); geometry keys compare by reference.