sipp11 11 years ago
parent
commit
ee3c5a2c1f
  1. 2
      s2.py
  2. 57
      s3.py

2
s2.py

@ -75,7 +75,7 @@ def produce_s2_part2(rank_result):
rank_no = 1 rank_no = 1
for rk in sorted(list(ro), reverse=True): for rk in sorted(list(ro), reverse=True):
# print(ii, ':', rk) # print(ii, ':', rk)
rows.append(['Rank#%s' % rank_no, rk]) rows.append(['Rank#%s' % rank_no, 'rank', rank_no, 'count', rk])
rank_no += 1 rank_no += 1
for i in ii: for i in ii:
# find order # find order

57
s3.py

@ -0,0 +1,57 @@
# -*- coding:utf-8 -*-
#!/usr/bin/env python
from __future__ import print_function
from base import Lo, create_csv
import os
import csv
import sys
los = Lo()
xmodels = {
'IMSf': {}, 'IMSD': {}, 'IMHf': {}, 'IMHD': {}, 'IFSf': {}, 'IFSD': {},
'IFHf': {}, 'IFHD': {}, 'CMSf': {}, 'CMSD': {}, 'CMHf': {}, 'CMHD': {},
'CFSf': {}, 'CFSD': {}, 'CFHf': {}, 'CFHD': {}, 'PMSf': {}, 'PMSD': {},
'PMHf': {}, 'PMHD': {}, 'PFSf': {}, 'PFSD': {}, 'PFHf': {}, 'PFHD': {},
}
fs = ('Case1_LS.csv', 'Case1_Gender.csv', 'Case1_Level.csv', 'Case1_SciF.csv')
def process_s2_data():
xm_data = {}
for ii in xmodels.keys():
fname = '%s-2.csv' % ii
fpath = os.path.join(os.getcwd(), 'build', 'part2', fname)
with open(fpath, 'rb') as f:
rows = csv.reader(f)
rank = 0
for r in rows:
if r[1] == "rank":
rank = r[2]
continue
if ii not in xm_data:
xm_data[ii] = {}
if rank not in xm_data[ii]:
xm_data[ii][rank] = {}
xm_data[ii][rank] = r[1].split(',')
return xm_data
def produce_match_all(xdata):
for ii in xmodels.keys():
los = set()
for _rank in xdata[ii]:
print(_rank)
def main(*argv):
xm = process_s2_data()
print(xm['CMHf'].keys())
produce_match_all(xm)
pass
if __name__ == '__main__':
if len(sys.argv) > 1:
main(sys.argv[1:])
else:
main()
Loading…
Cancel
Save