data = {}
with open('data.txt') as f:
    contents = csv.reader(f, delimiter=' ')
for name, attribute, value in contents:
    data[name] = data.get(name, {})
attr_name, attr_year = attribute.split('_')
attr_year = int(attr_year)
data[name][attr_name] = data[name].get(attr_name, {})
data[name][attr_name][attr_year] = value
calculate mean using numpy ndarray