Count By Property

Count occurrences of array elements grouped by a specified property.

Code

General
from collections import Counter
return dict(Counter(item[key] for item in arr))

Parameters

Array of objects

Property to count by

Server

More Python Snippets