Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- def common_id():
- limit = 100
- with open('WCA_export_Persons.tsv','rb') as tsvin:
- tsvin = csv.reader(tsvin, delimiter='\t')
- id_list = []
- count = []
- for line in tsvin:
- wca_id = line[0][4:8]
- if wca_id not in id_list:
- id_list.append(wca_id)
- count.append(0)
- i = id_list.index(wca_id)
- count[i] += 1
- c = 0
- previous = 0
- for x, y in sorted(zip(count, id_list))[::-1]:
- c += 1
- if c>limit and previous != x: break
- print str(x).zfill(3), y
- previous = x
- common_id()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement