from __future__ import division, print_function import json with file('TNET.json') as f: data = json.load(f, 'utf-8') commentors = {} for x in data: commentors.setdefault(x['name'].encode('utf-8'), []).append(x['likes']) for x in commentors: dat = commentors[x] print(len(dat), sum(x+1 for x in dat), sum(x+1 for x in dat)/len(dat), x, sep=':')