Python Summe bestimmte Posagen von Array


a = np.array([1,2,3,4])   # numpy array with 4 positions
indices = [0, 2]          # list of the indices to sum.

a[indices].sum()		  # returns a[0] + a[2]
Rui Coutinho