<human>:  How do I vectorize this loop in numpy?
<bot>: Here is some code to find the index of the maximum value in the array `arr` where the boolean condition in array `cond` is true

np.ma.array(np.tile(arr, 2).reshape(2, 3), mask=~cond).argmax(axis=1)

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.