swdata/gen_neighborhood_new.py
2023-03-15 21:16:16 +08:00

18 lines
431 B
Python

import json
from island.matches import Matches
# matches = Matches.from_profile_expr(lambda r:True)
matches = Matches('wos-data-2022-pd')
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)