apoc.coll.avg

Details

Syntax

apoc.coll.avg(coll)

Description

Returns the average of the numbers in the LIST<INTEGER | FLOAT>.

Arguments

Name

Type

Description

coll

LIST<INTEGER | FLOAT>

The list to return the average from.

Returns

FLOAT

Usage examples

The following computes the average of values in a list using Cypher and APOC:

apoc.coll.avg
WITH [1,2,3,4,5] AS list
RETURN apoc.coll.avg(list) AS output;
Cypher’s UNWIND and avg()
WITH [1,2,3,4,5] AS list
UNWIND list AS l
RETURN avg(l) AS output
Results
Output

3.0