mean

Edit pageLast modified: 05 June 2025

Computes the mean (average) of values.

null values are ignored.

All primitive numeric types are supported: Byte, Short, Int, Long, Float, and Double.

mean also supports the "mixed" Number type, as long as the column consists only of the aforementioned primitive numbers. The numbers are automatically converted to a common type for the operation.

The return type is always Double; Double.NaN for empty columns.

All operations on Double/Float/Number have the skipNaN option, which is set to false by default. This means that if a NaN is present in the input, it will be propagated to the result. When it's set to true, NaN values are ignored.

See statistics for details on complex data aggregations.

See column selectors for how to select the columns for this operation.