Вот полностью векторизованное решение:
X = [\
[(0,1), 2. ], \
[(2,2), 5. ], \
[(1,1), 0. ], \
[(2,2), 6. ], \
[(1,1), 4. ] \
]
# create a dataframe with x, y, and val. I'm not doing it very.
# efficiently here - but since you control the data structure
# you can just start from this kind of dataframe.
records = [(r[0], r[1], t) for r,t in X]
df = pd.DataFrame.from_records(records, columns=["x", "y", "val"])
A = np.zeros((3,3), dtype = 'float64')
df = df.groupby(["x", "y"], as_index = False).sum()
A[df.x, df.y] = df.val
вывод:
array([[ 0., 2., 0.],
[ 0., 4., 0.],
[ 0., 0., 11.]])