I'm imagining something like this:
import numpy as np
a = np.arange(12).reshape(4,3)
rows = np.asarray([1,2,3])
cols = np.argmax(a[rows], axis=1)
indices = np.stack((rows, cols)).T
a[indices] = 1
The desired output for a would then be
[[ 0 1 2]
[ 3 4 1]
[ 6 7 1]
[ 9 10 1]]
However, this doesn't work and doesn't change a. How does it work?
b?a[rows,cols] = 1?