MeanDocs

internal interface MeanDocs : CommonStatisticsDocs

The Mean Operation

Computes the mean (average) of values — the sum divided by the number of values.

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, BigDecimal) are not supported; convert them to a primitive number type first.

null values in the input are always ignored.

If the input contains NaN values, the result will be NaN, 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.

Mean Modes

Depending on what exactly you want the mean of, there are several modes. They are shown here for DataFrame, but they exist for the other receivers too:

  • mean() — the mean of each suitable column separately.

  • mean{ columns } — a single mean of means of the selected columns.

  • meanFor{ columns } — the mean of each selected column separately.

  • meanOf{ expression } — the mean of the values that the given expression returns for each row.

Related operation:

  • sum — the sum of values (mean is the sum divided by the number of values).

For more information: See mean on the documentation website.

For more information about unifying numbers: See "Number Unification" on the documentation website.

See all summary statistics: See "Summary statistics" on the documentation website.

Types

Link copied to clipboard

Selecting columns for various DataFrame operations can be done in the following ways:

Link copied to clipboard

Selecting columns for various DataFrame operations can be done in the following ways: