rowMeanOf
Returns the mean of the values of type T in this DataRow, as a Double.
Only the values in the columns of type T (or its nullable variant) are taken into account; all other columns of the row are ignored.
Columns inside column groups are also excluded. To include those in the mean, flatten the DataFrame first.
T must be a primitive number type or Number itself.
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 average 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 "mean Type Conversion" on the documentation website.
When there is nothing to average, for instance, when the input is empty or contains only null values, the result is Double.NaN.
See also:
— the mean of all the numbers in this row, of any number type.rowMean— the mean of the values in specific columns of ameanDataFrame.The Mean Operation— an overview of allmeanmodes.
For more information: See "Row statistics" on the documentation website.
Example
// The mean of all `Int` values ("age" and "weight") in the first row
df[0].rowMeanOf<Int>()
// The mean of all `Double` values in the first row, ignoring `NaN` values
df[0].rowMeanOf<Double>(skipNaN = true)Return
Parameters
Type Parameters
The type of the values to average. Only columns of this type are taken into account.