Lets say i have multiple numpy arrays like this: [1, 2, 4, 7, 1, 4, 6, 8, 1, 8, 2, 5]
I want to count the number of times each item appears in the array, and store the result in a dictionary:
{1: 3, 2: 2, 3: 0, 4: 2, 5: 1, 6: 1, 7: 1, 8: 2}
Is there a faster way to do this than to simply loop over the array and counting the items and storing them in dictionary?