NUnique / List Layer
Count unique values in each variable-length list. Similar to len(set()) in Python or n_distinct() in R. Returns an integer column with the count of distinct values.
Example transformation:
lists | n_unique |
---|---|
[1, 2, 2, 1, 3] | 3 |
[a, a, b, c, b] | 3 |
[true, true, false] | 2 |
[1, null, 1, 2, null] | 2 |
[null, null] | 0 |
[] | 0 |
Common applications:
- Analyzing user interaction patterns
- Counting distinct product categories
- Measuring feature diversity
- Detecting unique visitors
- Analyzing vocabulary richness
- Finding unique error types
- Measuring data cardinality
Note: Lists can have any length. Null values are ignored in counting. Empty lists return 0. Type-sensitive comparison for uniqueness. Particularly useful for analyzing diversity in variable-length sequences.
Table
0
0
Table
Select
columnThe variable-length list column to analyze. Examples:
- User actions: [click, scroll, click, type]
- Product categories: [food, food, electronics]
- Error codes: [E001, E002, E001, E003]
- Measurements: [1.1, 1.1, 1.2, 1.3] Lists can have different lengths. Type-consistent comparisons.
AsColumn
nameName for the new column. If not provided, the system generates a unique name. If AsColumn
matches an existing column, the existing column is replaced. The name should follow valid column naming conventions.