can anybody please give me a hint how to aggregate (sum up) specific elements of multiple lists?
For example I have 20 lists with a similar name pattern, each represe
You can create a list of lists, and then use numpy arrays:
import numpy as np
c_agent_0 = [10.0, 11.0, 12.0]
c_agent_1 = [13.0, 14.0, 15.0]
c_agent_2 = [16.0, 17.0, 18.0]
mylist = [c_agent_0, c_agent_1, c_agent_2]
mylist = sum(map(np.array, mylist))
print mylist[0]
Note that a list comprehension is most likely faster; this is just a solution with numpy :).