stdOf
Returns the standard deviation of the values that the given expression returns for each element of this DataColumn, as a Double.
The result of the expression is considered the 'input' of this operation.
All primitive number types are supported: Byte, Short, Int, Long, Float, and Double. "Mixed" Number input is supported too, as long as it consists solely of those primitive numbers; its values are then first converted to their common type using UnifiedNumberTypeOptions.PRIMITIVES_ONLY, see number unification. Big numbers (, BigInteger) are not supported; BigDecimal them to a primitive number type first.convert
null values in the input are always ignored.
If the input contains values, the result will be NaNNaN, unless skipNaN is set to true.
The resulting standard deviation is always a Double and never null. Converting Long values to Double may lose precision for very large values.
For more information about the resulting types: See "std Type Conversion" on the documentation website.
When there is nothing to compute the standard deviation of, for instance, when the input is empty or contains only null values, the result is Double.NaN. The same holds when there are no more than ddof values, so, by default, for a single value.
See also:
— the standard deviation of the values in this column itself.std— the mean of those values.meanOfThe Std Operation— an overview of allstdmodes.
For more information: See std on the documentation website.
Example
// The standard deviation of the lengths of all first names in the "name"/"firstName" column
df.name.firstName.stdOf { it.length }Return
The standard deviation of the values expression returns, as a Double.
Parameters
A function that returns the value to include for each element of this column.
"Delta Degrees of Freedom". The divisor used in the calculation is N - ddof, where N is the number of values. The default is 1, which applies Bessel's correction and computes the unbiased sample standard deviation (as in R). Use 0 for the population standard deviation (as in Numpy).
Returns the standard deviation of the values that the given expression returns for each row of this DataFrame, as a Double.
The given RowExpression is evaluated for each row of the dataframe. The row is both the receiver and the argument (it) of the expression, so the values in it can be accessed directly.
For more information: See RowExpression on the documentation website.
The result of the expression is considered the 'input' of this operation.
All primitive number types are supported: Byte, Short, Int, Long, Float, and Double. "Mixed" Number input is supported too, as long as it consists solely of those primitive numbers; its values are then first converted to their common type using UnifiedNumberTypeOptions.PRIMITIVES_ONLY, see number unification. Big numbers (, BigInteger) are not supported; BigDecimal them to a primitive number type first.convert
null values in the input are always ignored.
If the input contains values, the result will be NaNNaN, unless skipNaN is set to true.
The resulting standard deviation is always a Double and never null. Converting Long values to Double may lose precision for very large values.
For more information about the resulting types: See "std Type Conversion" on the documentation website.
When there is nothing to compute the standard deviation of, for instance, when the input is empty or contains only null values, the result is Double.NaN. The same holds when there are no more than ddof values, so, by default, for a single value.
See also:
std{ columns }— a single standard deviation of all values in the selected columns.— the mean of the values of the given expression.meanOfThe Std Operation— an overview of allstdmodes.
For more information: See std on the documentation website.
Example
// The standard deviation of the weight-to-age ratios of all rows
df.stdOf { (weight ?: 0) / age }Return
The standard deviation of the values expression returns, as a Double.
Parameters
"Delta Degrees of Freedom". The divisor used in the calculation is N - ddof, where N is the number of values. The default is 1, which applies Bessel's correction and computes the unbiased sample standard deviation (as in R). Use 0 for the population standard deviation (as in Numpy).
The RowExpression to compute the value to include for each row.
Aggregates this GroupBy by computing the standard deviation of the values that the given expression returns for each row of a group.
Returns a new DataFrame with one row per group, containing the group key columns and a single column with the standard deviation per group, named name (or "std" if name is null).
The given RowExpression is evaluated for each row of the dataframe. The row is both the receiver and the argument (it) of the expression, so the values in it can be accessed directly.
For more information: See RowExpression on the documentation website.
The result of the expression is considered the 'input' of this operation.
All primitive number types are supported: Byte, Short, Int, Long, Float, and Double. "Mixed" Number input is supported too, as long as it consists solely of those primitive numbers; its values are then first converted to their common type using UnifiedNumberTypeOptions.PRIMITIVES_ONLY, see number unification. Big numbers (, BigInteger) are not supported; BigDecimal them to a primitive number type first.convert
null values in the input are always ignored.
If the input contains values, the result will be NaNNaN, unless skipNaN is set to true.
The resulting standard deviation is always a Double and never null. Converting Long values to Double may lose precision for very large values.
For more information about the resulting types: See "std Type Conversion" on the documentation website.
Result cells for which there is nothing to compute the standard deviation of (for instance, because the input was empty or contained only null values) simply become Double.NaN. The same holds when there are no more than ddof values, so, by default, for a single value.
See also:
— a single standard deviation of all values in the selected columns, per group.std— the mean of those values, per group.meanOf— the general way to aggregate groups.aggregateThe Std Operation— an overview of allstdmodes.
For more information: See "groupBy statistics" on the documentation website., and See "GroupBy Aggregation Statistics" on the documentation website.
Example
// For each city, the standard deviation of the weight-to-age ratios, in a column called "stdRatio"
df.groupBy { city }.stdOf("stdRatio") { (weight ?: 0) / age }Return
A new DataFrame with the group keys and a single standard deviation per group.
Parameters
The name of the resulting column. If null (the default), "std" is used. This name needs to be unique, else a DuplicateColumnPathInsertException is thrown.
"Delta Degrees of Freedom". The divisor used in the calculation is N - ddof, where N is the number of values. The default is 1, which applies Bessel's correction and computes the unbiased sample standard deviation (as in R). Use 0 for the population standard deviation (as in Numpy).
The RowExpression to compute the value to include for each row.
Aggregates this Pivot by computing the standard deviation of the values that the given expression returns for each row, per group.
Returns a single DataRow with the pivot keys as (nested) columns, containing the standard deviation of the expression's results for the rows of the corresponding group.
The given RowExpression is evaluated for each row of the dataframe. The row is both the receiver and the argument (it) of the expression, so the values in it can be accessed directly.
For more information: See RowExpression on the documentation website.
The result of the expression is considered the 'input' of this operation.
All primitive number types are supported: Byte, Short, Int, Long, Float, and Double. "Mixed" Number input is supported too, as long as it consists solely of those primitive numbers; its values are then first converted to their common type using UnifiedNumberTypeOptions.PRIMITIVES_ONLY, see number unification. Big numbers (, BigInteger) are not supported; BigDecimal them to a primitive number type first.convert
null values in the input are always ignored.
If the input contains values, the result will be NaNNaN, unless skipNaN is set to true.
The resulting standard deviation is always a Double and never null. Converting Long values to Double may lose precision for very large values.
For more information about the resulting types: See "std Type Conversion" on the documentation website.
Result cells for which there is nothing to compute the standard deviation of (for instance, because the input was empty or contained only null values) simply become Double.NaN. The same holds when there are no more than ddof values, so, by default, for a single value.
Check out the .Pivot Grammar
See also:
std{ columns }— a single standard deviation of all values in the selected columns, per group.Pivot aggregation— all other ways to aggregate aPivot.The Std Operation— an overview of allstdmodes.
For more information: See "pivot statistics" on the documentation website., and See "Pivot Aggregation statistics" on the documentation website.
Example
// For each city, the standard deviation of the weight-to-age ratios
df.pivot { city }.stdOf { (weight ?: 0) / age }Return
A single DataRow with, per pivot group, the standard deviation of the expression's results.
Parameters
"Delta Degrees of Freedom". The divisor used in the calculation is N - ddof, where N is the number of values. The default is 1, which applies Bessel's correction and computes the unbiased sample standard deviation (as in R). Use 0 for the population standard deviation (as in Numpy).
The RowExpression to compute the value to include for each row.
Aggregates this PivotGroupBy by computing the standard deviation of the values that the given expression returns for each row, per group.
Returns a DataFrame where each cell contains the standard deviation of the expression's results for the rows of the group corresponding to that pivot key (column) and groupBy key (row).
The given RowExpression is evaluated for each row of the dataframe. The row is both the receiver and the argument (it) of the expression, so the values in it can be accessed directly.
For more information: See RowExpression on the documentation website.
The result of the expression is considered the 'input' of this operation.
All primitive number types are supported: Byte, Short, Int, Long, Float, and Double. "Mixed" Number input is supported too, as long as it consists solely of those primitive numbers; its values are then first converted to their common type using UnifiedNumberTypeOptions.PRIMITIVES_ONLY, see number unification. Big numbers (, BigInteger) are not supported; BigDecimal them to a primitive number type first.convert
null values in the input are always ignored.
If the input contains values, the result will be NaNNaN, unless skipNaN is set to true.
The resulting standard deviation is always a Double and never null. Converting Long values to Double may lose precision for very large values.
For more information about the resulting types: See "std Type Conversion" on the documentation website.
Result cells for which there exists a group, but there is nothing to compute the standard deviation of (for instance, because the group was empty or contained only null values) simply become Double.NaN. The same holds when there are no more than ddof values, so, by default, for a single value.
For empty pivot intersections, null or the set default is used.
Check out the .PivotGroupBy Grammar
See also:
std{ columns }— a single standard deviation of all values in the selected columns, per group.PivotGroupBy aggregation— all other ways to aggregate aPivotGroupBy.The Std Operation— an overview of allstdmodes.
For more information: See "pivot statistics" on the documentation website., and See "Pivot Aggregation statistics" on the documentation website.
Example
// Per city and last name, the standard deviation of the weight-to-age ratios
df.pivot { city }.groupBy { name.lastName }.stdOf { (weight ?: 0) / age }Return
A DataFrame with, per group, the standard deviation of the expression's results.
Parameters
"Delta Degrees of Freedom". The divisor used in the calculation is N - ddof, where N is the number of values. The default is 1, which applies Bessel's correction and computes the unbiased sample standard deviation (as in R). Use 0 for the population standard deviation (as in Numpy).
The RowExpression to compute the value to include for each row.