average list of dictionaries in python -
i have list of dictionary this
data = [{'name': 'john', 'height': 176, 'weight':62, 'iq':120,..},...]
the .. signifies various other integer/float attributes , elements of list has same format..
i want average height, weight , other numerical attributes in cleanest/easiest way.
i not come better way normal looping messy... , don't want use external packages
you can use following
sum([item['weight'] item in data])/len(data)
and use
float(len(data))
if want more exact value.
Comments
Post a Comment