|
|
@ -1,7 +1,7 @@ |
|
|
|
# -*- coding:utf-8 -*- |
|
|
|
# -*- coding:utf-8 -*- |
|
|
|
#!/usr/bin/env python |
|
|
|
#!/usr/bin/env python |
|
|
|
from __future__ import print_function |
|
|
|
from __future__ import print_function |
|
|
|
from base import Lo |
|
|
|
from base import Lo, RAW_DIR, TARGET_DIR |
|
|
|
import os |
|
|
|
import os |
|
|
|
import csv |
|
|
|
import csv |
|
|
|
import sys |
|
|
|
import sys |
|
|
@ -17,10 +17,10 @@ def get_rank_thing(filename, **kwargs): |
|
|
|
} |
|
|
|
} |
|
|
|
output_filename = kwargs.get('output', '%s-output.csv' % filename) |
|
|
|
output_filename = kwargs.get('output', '%s-output.csv' % filename) |
|
|
|
count = tot = lo_match = 0 |
|
|
|
count = tot = lo_match = 0 |
|
|
|
with open(os.path.join(os.getcwd(), 'build', output_filename), 'wb') as o: |
|
|
|
with open(os.path.join(TARGET_DIR, output_filename), 'wb') as o: |
|
|
|
owriter = csv.writer(o, delimiter=',', quotechar='"', |
|
|
|
owriter = csv.writer(o, delimiter=',', quotechar='"', |
|
|
|
quoting=csv.QUOTE_ALL) |
|
|
|
quoting=csv.QUOTE_ALL) |
|
|
|
with open(os.path.join(os.getcwd(), 'raw', filename)) as f: |
|
|
|
with open(os.path.join(RAW_DIR, filename)) as f: |
|
|
|
reader = csv.reader(f) |
|
|
|
reader = csv.reader(f) |
|
|
|
reader.next() |
|
|
|
reader.next() |
|
|
|
for r in reader: |
|
|
|
for r in reader: |
|
|
@ -28,8 +28,10 @@ def get_rank_thing(filename, **kwargs): |
|
|
|
w = [ |
|
|
|
w = [ |
|
|
|
r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], # July 1 |
|
|
|
r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], # July 1 |
|
|
|
rank_no, # July 1 |
|
|
|
rank_no, # July 1 |
|
|
|
r[10], r[11], r[12], r[13], r[14] |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
## add 24 model's weight |
|
|
|
|
|
|
|
for i in xrange(10, 34): |
|
|
|
|
|
|
|
w.append(r[i]) |
|
|
|
q = ( |
|
|
|
q = ( |
|
|
|
('A', r[1]), ('B', r[2]), ('C', r[3]), ('D', r[4]), |
|
|
|
('A', r[1]), ('B', r[2]), ('C', r[3]), ('D', r[4]), |
|
|
|
('E', r[5]), ('F', r[6]), ('G', r[7]), ('H', r[8]), |
|
|
|
('E', r[5]), ('F', r[6]), ('G', r[7]), ('H', r[8]), |
|
|
@ -67,7 +69,7 @@ def main(*argv): |
|
|
|
mx = [set(j) for i, j in x.items()] |
|
|
|
mx = [set(j) for i, j in x.items()] |
|
|
|
order = sorted(list(set.union(*mx))) |
|
|
|
order = sorted(list(set.union(*mx))) |
|
|
|
sum_file = '%s-result.csv' % fs[f] |
|
|
|
sum_file = '%s-result.csv' % fs[f] |
|
|
|
with open(os.path.join(os.getcwd(), 'build', sum_file), 'wb') as o: |
|
|
|
with open(os.path.join(TARGET_DIR, sum_file), 'wb') as o: |
|
|
|
result_writer = csv.writer(o, delimiter=',', quotechar='"', |
|
|
|
result_writer = csv.writer(o, delimiter=',', quotechar='"', |
|
|
|
quoting=csv.QUOTE_ALL) |
|
|
|
quoting=csv.QUOTE_ALL) |
|
|
|
m = {} |
|
|
|
m = {} |
|
|
|