diff --git a/base.py b/base.py index d7f687b..7494025 100644 --- a/base.py +++ b/base.py @@ -37,6 +37,7 @@ class Lo: self.model[k][v].append(lo_id) self.los[lo_id] = t.copy() self.los[lo_id]['weight'] = r[35] + self.los[lo_id]['model'] = r[1] def get(self, lo_id): try: diff --git a/s4.py b/s4.py index 796db7f..3cf3e3d 100755 --- a/s4.py +++ b/s4.py @@ -45,10 +45,13 @@ def produce(match_all): rows = [] weight = get_weight(ii) for lo in sorted(los.los): - is_matched = 1 if lo in match_all[ii] else 0 + is_matched = 1 if ii.lower() == los.los[lo]['model'].lower() else 0 r = [lo, is_matched, los.los[lo]['weight']] - if is_matched: + try: r += weight[lo][1:] + except KeyError: + # print(ii, ' = ', is_matched, ' / ', lo) + pass rows.append(r) _f = '%s-step4.csv' % ii create_csv(_f, rows, directory='part4')