Lets say I have a numpy array as below:
array([ 1. , 2. , 0. , 3.4, 0. , 1.1])
Now I want to get indices of all the elements which are zero. Reason being I want to get those indices and then for a different array I want to convert the elements on same indices to zero.
To get indices of non zero I know we can use nonzero or argwhere.
np.nonzero(a)
(array([0, 1, 3, 5]),)
Then lets say I have array b I can use the above indices list and convert all the elements of array b with same indices to zero like below:
b[np.nonzero(a)]=0
This is fine but it is for non zero indices. How to get for zero indices.