I would like to get the sum of each teams score in each round, currently I am able to get the sum of each teams scores from round 1.
Current Input
scores = np.array([
[1, 2, 2, 3, 5, 8, 12], #Round 1
[11, 3, 9, 2, 3, 5, 10]] # Round 2
)
teams = np.array([[0, 1, 2], [1, 2, 3], [6, 5, 4]])
np.sum(np.take(scores, teams), axis=1)
This outputs the correct sum for each team in the round 1
array([ 5, 7, 25])
Is there a way to make it output the sum for each team in each round without using a for loop?
Desired Output
array([[ 5, 7, 25], [23, 14, 18]])
scores[0][0]