Oct-03-2020, 07:01 AM
Your solution is quite slow because you are using pure Python loops. For this problem
complete vectorized solution exists:
complete vectorized solution exists:
np.argmax(np.repeat(y_i[:, np.newaxis], len(y), axis=1) >= y, axis=0)It is expected that
y
is a numpy array of shape (len(y), )
.