np.array(
[[0,13,0,2,0,0,0,0,0,0,0,0],
[0,0,15,0,9,0,0,0,0,0,0,0],
[0,0,0,0,0,18,0,0,0,0,0,0],
[0,0,0,0,27,0,20,0,0,0,0,0],
[0,0,0,0,0,20,0,10,0,0,0,0],
[0,0,0,0,0,0,0,0,8,0,0,0],
[0,0,0,0,0,0,0,14,0,14,0,0],
[0,0,0,0,0,0,0,0,12,0,25,0],
[0,0,0,0,0,0,0,0,0,0,0,11],
[0,0,0,0,0,0,0,0,0,0,15,0],
[0,0,0,0,0,0,0,0,0,0,0,7],
[0,0,0,0,0,0,0,0,0,0,0,0]])
I am trying to find how to take a numpy array like above and then in one performant operation mask it with indexes of elements I want zeroed
[0,1] [1,4] [4,7] [7,8] [8,11]
So what I am left with is
np.array(
[[0,0,0,2,0,0,0,0,0,0,0,0],
[0,0,15,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,18,0,0,0,0,0,0],
[0,0,0,0,27,0,20,0,0,0,0,0],
[0,0,0,0,0,20,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,8,0,0,0],
[0,0,0,0,0,0,0,14,0,14,0,0],
[0,0,0,0,0,0,0,0,0,0,25,0],
[0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,15,0],
[0,0,0,0,0,0,0,0,0,0,0,7],
[0,0,0,0,0,0,0,0,0,0,0,0]])
Something like the functionality of np.in1d but for a 2d array? I can iterate over each element but the arrays can be truly massive so vector single operation mask would be best. Is it possible? If this is a stupid question I'm sure I'll be told!