from collections import Counter
tlist = [1,2,1,3,2,'1']
Counter(tlist)
Out[13]: Counter({1: 2, '1': 1, 2: 2, 3: 1})
type(Counter(tlist))
Out[14]: collections.Counter
dict(Counter(tlist))
Out[15]: {1: 2, '1': 1, 2: 2, 3: 1}
from collections import Counter
tlist = [1,2,1,3,2,'1']
Counter(tlist)
Out[13]: Counter({1: 2, '1': 1, 2: 2, 3: 1})
type(Counter(tlist))
Out[14]: collections.Counter
dict(Counter(tlist))
Out[15]: {1: 2, '1': 1, 2: 2, 3: 1}