apoc.coll.frequenciesAsMap

Function

apoc.coll.frequenciesAsMap(coll LIST<ANY>) - returns a MAP of frequencies of the items in the collection, keyed by item and count.

Signature

apoc.coll.frequenciesAsMap(coll :: LIST<ANY>) :: MAP

Input parameters

Name Type Default

coll

LIST<ANY>

null

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;
Table 1. Results
Output
{
  "1": 1,
  "3": 1,
  "5": 1,
  "7": 1,
  "9": 2
}