swdata/gen_neighborhood_new.py
2022-07-22 21:36:39 +08:00

18 lines
428 B
Python

import json
from island.matches import Matches
# matches = Matches.from_profile_expr(lambda r:True)
matches = Matches('wos-data-2022')
neighbors = {}
for i in range(len(matches.data)):
m = matches.data[i]
n = {}
for r in m.query('player', 'sight').raw_data:
n[r['player']] = r['sight']
neighbors[matches.names[i]] = n
with open('outputs/neighborhood_new.json', 'w') as f:
json.dump(neighbors, f)