Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
182 views
in Technique[技术] by (71.8m points)

grouping on tems in a list in python

I have 60 records with a column "skillsList" "("skillsList" is a list of skills) and "IdNo". I want to find out how many "IdNo's" have a skill in common.

How can I do it in python. I am not knowing how to take the count of a particular list item. Would appreciate any help.

>>> a = open("C:UsersabcDesktopBook2.csv")
>>> type(a1)
<type 'str'>

Some of the text when I print a1

>>> a1
'IdNo, skillsList
1,"u'Training', u'E-Learning', u'PowerPoint', u'Teaching', u'Accounting', u'Team Management', u'Team Building', u'Microsoft Excel', u'Microsoft Office', u'Financial Accounting', u'Microsoft Word', u'Customer Service'"
2,"u'Telecommunications', u'Data Center', u'ISO 27001', u'Management', u'BS25999', u'Technology', u'Information Technology...', u'Certified PMP\xae', u'Certified BS25999 Lead...'"
3,"u'Market Research', u'Segmentation', u'Marketing Strategy', u'Consumer Behavior', u'Experience Working with...'"

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You have to do it by yourself. you may use a dictionnary of skills , each item of the dic beeing inited to zero. Then iterate over your records and increment skill item when seen.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...