I have a list of lists
list = [[1,0],[1,2],[1,1],[1,0]]
Now I want to count the number of occurrences similar list elements in the above list.
e;g; [1,0]:2, [1,2]:1, [1,1]:1
I did
import collections
print Counter(list)
It throws error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/collections.py", line 352, in __init__
self.update(iterable, **kwds)
File "/usr/local/lib/python2.7/collections.py", line 434, in update
self[elem] = self_get(elem, 0) + 1
TypeError: unhashable type: 'list'
What am i doing wrong?