from numpy.random import randint
orig_list = randint(0, 99, 1000)
dictionary = {}
for item in orig_list:
if not item in dictionary:
dictionary[item] = 0
dictionary[item] += 1
I know I can loop through the list
and do dictionary[item] += 1
, but is there no faster way?