Tips¶
collections.Counter
is similar to a dict
object.
You can iterate through it similarly to how you iterate through a dict
.
In [25]:
from collections import Counter
x = [1, 2, 3, 4, 5, 5, 4, 3, 3]
cntr = Counter(x)
cntr
Out[25]:
In [27]:
cntr.items()
Out[27]:
In [28]:
cntr.values()
Out[28]:
In [29]:
cntr.values()
Out[29]:
In [ ]: