Say I have 2 arrays
X = np.array([1.,2.,3.,4.,5.,])
Y = np.array([6.,7.,8.,9.,10.,])
and I want to define an array that takes a value of say 1 wherever X < 3 or Y = 9 and takes a value of 0 everywhere else. I used
Z=[1 if i < 3 or j==9 else 0 for i in X and j in Y]
print(Z)
I expect an array that looks like
[1,1,0,1,0]
but I got this error:
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()