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)