apoc.coll.frequenciesAsMap

Function

apoc.coll.frequenciesAsMap(coll [Any]) - returns a map of frequencies of the items in the collection, keyed by item and count.

Signature

apoc.coll.frequenciesAsMap(coll :: LIST? OF ANY?) :: (MAP?)

Input parameters

Name Type Default

coll

LIST? OF 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
}