apoc.coll.frequenciesAsMap

Details

Syntax

apoc.coll.frequenciesAsMap(coll)

Description

Returns a MAP of frequencies of the items in the collection, keyed by item and count.

Arguments

Name

Type

Description

coll

LIST<ANY>

The list to return items and their count from.

Returns

MAP

Usage examples

The following returns a MAP containing each item and their frequency in a collection:

RETURN apoc.coll.frequenciesAsMap([1,3,5,7,9,9]) AS output;
Results
Output
{
  "1": 1,
  "3": 1,
  "5": 1,
  "7": 1,
  "9": 2
}