stdBy
stdBy returns the sample standard deviation for each group. Null values are ignored.
Caution
Applying this aggregation to a column where the sample standard deviation cannot be computed will result in an error. For example, the standard deviation is not defined for a column of string values.
Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
| groupByColumns | String... | The column(s) by which to group data.
|
| groupByColumns | ColumnName... | The column(s) by which to group data.
|
| groupByColumns | Collection<String> | The column(s) by which to group data.
|
Returns
A new table containing the sample standard deviation for each group.
How to calculate standard deviation
Sample standard deviation is a measure of the average dispersion of data values from the mean. Unlike sample variance, it is on the same scale as the data, meaning that sample standard deviation can be readily interpreted in the same units as the data. The formula for sample standard deviation is as follows:
Examples
In this example, stdBy returns the sample standard deviation of the whole table. Because the sample standard deviation cannot be computed for the string columns X and Y, these columns are dropped before applying stdBy.
In this example, stdBy returns sample the standard deviation, as grouped by X. Because sample the standard deviation cannot be computed for the string column Y, this column is dropped before applying stdBy.
In this example, stdBy returns the sample standard deviation, as grouped by X and Y.