Search
 
SCRIPT & CODE EXAMPLE
 

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}
>>>
Comment

PREVIOUS NEXT
Code Example
Python :: python convert b string to dict 
Python :: python create gif 
Python :: django update field after save 
Python :: python tkinter button image 
Python :: Group by a column, count sum of other columns 
Python :: python tkinter dynamic toggle button 
Python :: how can I corect word spelling by use of nltk? 
Python :: How can you hide a tkinter window 
Python :: python enumerate 
Python :: makemigration django 
Python :: cv2 frame size 
Python :: decimal to binary python 
Python :: python string iterate 3 characters at a time 
Python :: python set attribute by string name 
Python :: list vs tuple python 
Python :: python unittest coverage main function 
Python :: django unique validator 
Python :: WARNING: This is a development server 
Python :: select random img in python using os.listdir 
Python :: replace nan 
Python :: how to negate a boolean python 
Python :: python treemap example 
Python :: structure ternaire python 
Python :: pandas split tuple column 
Python :: how to configure a button in python tkinter 
Python :: tqdm 2 progress bars 
Python :: add row to dataframe with index 
Python :: import matplotlib pyplot as plt 
Python :: how to use sort in python 
Python :: How to sort a Python dict by value 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =