mean
Computes the mean of values.
Is available for numeric columns. Computed value has type Double
. Use skipNA
flag to skip NA
values (null
and NaN
).
df.mean() // mean of values per every numeric column
df.mean(skipNA = true) { age and weight } // mean of all values in `age` and `weight`, skips NA
df.meanFor(skipNA = true) { age and weight } // mean of values per `age` and `weight` separately, skips NA
df.meanOf { (weight ?: 0) / age } // median of expression evaluated for every row
df.mean()
df.age.mean()
df.groupBy { city }.mean()
df.pivot { city }.mean()
df.pivot { city }.groupBy { name.lastName }.mean()
See statistics for details on complex data aggregations.
Last modified: 27 September 2024