avg

statistics

Calculates the arithmetic mean (average) of values

Syntax

avg(array|dataframe)

Parameters

array|dataframe (array or dataframe)

The data to calculate the average of

Returns

number

The arithmetic mean of the values

Examples

Input:
[1, 2, 3, 4, 5] | avg
Output:
3
Average score from students
Input:
map(.score) | avg
Output:
82.5
Average salary from employees
Input:
.salary | avg
Output:
65000

The avg() function calculates the arithmetic average of numeric values in an array or DataFrame column. This is an alias for mean().

Usage

Use avg() for statistical analysis, data summarization, and calculating central tendency.

Related Functions