Mean / List Layer
Calculate the arithmetic mean (average) of values in each variable-length numeric list. Similar to numpy.mean() or R's mean(). Returns a floating-point column containing the average of non-null values in each list.
Example transformation:
lists | mean |
---|---|
[1, 2, 3, 4] | 2.5 |
[10.5, 11.5] | 11.0 |
[-1, 0, 1] | 0.0 |
[100] | 100.0 |
[1, null, 3] | 2.0 |
[] | null |
[null, null] | null |
Common applications:
- Calculating average prices
- Computing mean temperatures
- Analyzing central tendencies
- Finding average response times
- Measuring typical usage levels
- Computing score averages
Note: Only works with numeric lists. Null values are ignored in mean calculation unless list is empty or contains only nulls, then returns null. Lists can have any length. Result is always floating-point, even for integer inputs.
Select
columnThe variable-length numeric list column to average. Examples:
- Daily temperatures: [22.5, 23.1, 21.8, 22.3]
- Test scores: [85, 92, 88, 90]
- Response times: [0.12, 0.15, 0.11]
- Measurements: [1.1, 1.2, null, 1.3] Lists can have different lengths. Only numeric types supported.
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.