From 15d74b305233f2ec40d24975689f25c164b53126 Mon Sep 17 00:00:00 2001 From: sipp11 Date: Fri, 13 Jun 2014 02:48:21 +0700 Subject: [PATCH] Fixing part2 ranking thing --- s2.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/s2.py b/s2.py index 780c755..f28d858 100755 --- a/s2.py +++ b/s2.py @@ -14,6 +14,17 @@ xmodels = { 'CFSf': {}, 'CFSD': {}, 'CFHf': {}, 'CFHD': {}, 'PMSf': {}, 'PMSD': {}, 'PMHf': {}, 'PMHD': {}, 'PFSf': {}, 'PFSD': {}, 'PFHf': {}, 'PFHD': {}, } +rk_conv = { + 'I': ['4', '3', '2', ''], + 'P': ['4', '3', '2', ''], + 'C': ['4', '3', '2', ''], + 'F': ['5', '4', '3', '2', ''], + 'M': ['5', '4', '3', '2', ''], + 'H': ['4', '3', '2', ''], + 'S': ['4', '3', '2', ''], + 'f': ['4', '3', '2', ''], + 'D': ['4', '3', '2', ''], +} fs = ('Case1_LS.csv', 'Case1_Gender.csv', 'Case1_Level.csv', 'Case1_SciF.csv') @@ -60,7 +71,7 @@ def produce_s2_part1(sum_result): create_csv(_f, rows, directory='part2') -def produce_s2_part2(rank_result): +def produce_s2_part2_old(rank_result): # create xxxx-2.csv for ii in xmodels.keys(): rows = [] @@ -87,6 +98,23 @@ def produce_s2_part2(rank_result): create_csv(_f, rows, directory='part2') +def produce_s2_part2(rank_result): + # create xxxx-2.csv + for ii in xmodels.keys(): + rows = [] + for rk in xrange(0, 4): + rank_no = rk + 1 + # print(ii, ':rank:', rank_no) + rows.append(['Rank#%s' % rank_no, 'rank', rank_no]) + for i in ii: + if not rk_conv[i][rk]: + continue + # print(i, '::', rk_conv[i][rk]) + rows.append([i, ','.join(rank_result[i][rk_conv[i][rk]])]) + _f = '%s-2.csv' % ii + create_csv(_f, rows, directory='part2') + + def process_lo_weight(): los = {} for i in fs: