lets say we have this array:
Sample_array = [1,2,4,4,5,1,2,4]
and we want to know how many times each element occurs in this array, without using numpy what is the easiest and simplest way to do it?
lets say we have this array:
Sample_array = [1,2,4,4,5,1,2,4]
and we want to know how many times each element occurs in this array, without using numpy what is the easiest and simplest way to do it?
You can use an internal python library named Counter like below:
from collections import Counter
Counter(Sample_array)
Counter({1: 2, 2: 2, 4: 3, 5: 1})