a = np.array([[11,12,39,14], [15,16,29,18]])
b = np.array([[1,2,3,4], [5,6,7,8]])
The expected result is[5,6,3,8]
I tried but could not solve.
result = b[range(len(a)), a.argmax(0)]
print (result)
>Solution :
You were almost there, you sliced in the incorrect order:
result = b[a.argmax(0), range(a.shape[1])]
Output: array([5, 6, 3, 8])