rowMean
Returns the mean of all the numbers in this DataRow, as a Double.
Only the values in the columns of a primitive number type (and in "mixed" Number columns) 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.
Since the values of different columns are averaged together, the result is the mean of all those values converted to their common type.
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 the values of one specific number type in this row.rowMeanOf<Type>()— the sum of all the numbers in this row.rowSum— 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 numbers ("age" and "weight") in the first row
// Columns of other types ("name" and "address") are ignored
df[0].rowMean()Return
The mean of all the numbers in this row, as a Double.