I have two numpy arrays: a
and b
. I want to select all of the indices where a == 1
and b == 0
.
That is, if I have the following arrays:
a = [0, 1, 3, 5, 1, 1, 2]
b = [1, 0, 2, 5, 3, 0, 6]
I would like to get the following indices back:
[1, 5]
How should I do this in numpy? I have tried using the following (suggested by a quick reference guide showing differences between numpy, matlab and IDL):
(a == 1 and b == 0).nonzero()
But that gives an error about truth values being ambiguous.
Any ideas?