Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

map a list to another list python

>>> x=['a','a','b','c','c','c']
>>> map(x.count,x)
[2, 2, 1, 3, 3, 3]
>>> dict(zip(x,map(x.count,x)))
{'a': 2, 'c': 3, 'b': 1}
>>>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #map #list #list #python
ADD COMMENT
Topic
Name
9+3 =