Having a 2d numpy array, for example
data = np.ones((3, 5))
how can i create an boolean mask for this array for all elements of a row up to a specific index stored row-wise in another np.array. So the “end index” array looks like
np.array([0, 2, 3])
The output should look like:
[[True False False False False]
[True True True False False]
[True True True True False]]
I tried fancy indexing with a row and column array, but dont know how to specify the column ranges for each row.