Browse Source

This should fix misunderstanding I have previously

There is no more limit in rank since max is #4 anyway
master
sipp11 11 years ago
parent
commit
4b4dfecb0f
  1. 11
      s1.py
  2. 19
      s2.py

11
s1.py

@ -62,7 +62,8 @@ def main(*argv):
result_writer = csv.writer(o, delimiter=',', quotechar='"',
quoting=csv.QUOTE_ALL)
m = {}
for i in xrange(0, 3):
# print(j, ':', order)
for i in xrange(0, len(order)):
result_writer.writerow(['count', order[i]])
# print('count , ', order[i], ' / ', type(order[i]))
for j in x.keys():
@ -70,10 +71,10 @@ def main(*argv):
# print(j, ', ', s)
lo_result = mc[j][order[i]]
# print(order[i], ' == ', len(lo_result))
if i == 2 and len(mc[j]) > 3:
for _i in xrange(3, len(mc[j])):
lo_result = lo_result.union(mc[j][order[_i]])
# print(' ==EX== ', len(lo_result))
# if i == 2 and len(mc[j]) > 3:
# for _i in xrange(3, len(mc[j])):
# lo_result = lo_result.union(mc[j][order[_i]])
# # print(' ==EX== ', len(lo_result))
if j not in m:
m[j] = lo_result
else:

19
s2.py

@ -64,14 +64,25 @@ def produce_s2_part2(rank_result):
# create xxxx-2.csv
for ii in xmodels.keys():
rows = []
for rk in xrange(0, 3):
rows.append(['Rank#%s' % (rk+1), ])
# get rank count first
ro = set()
for rk in xrange(0, 4):
for i in ii:
if i not in rank_result:
continue
ro = ro.union(set(rank_result[i].keys()))
rank_no = 1
for rk in sorted(list(ro), reverse=True):
# print(ii, ':', rk)
rows.append(['Rank#%s' % rank_no, rk])
rank_no += 1
for i in ii:
# find order
if i not in rank_result:
continue
o = sorted(rank_result[i].keys(), reverse=True)
rows.append([i, ','.join(rank_result[i][o[rk]])])
if rk in rank_result[i]:
rows.append([i, ','.join(rank_result[i][rk])])
_f = '%s-2.csv' % ii
create_csv(_f, rows, directory='part2')

Loading…
Cancel
Save