I have met a issue. For example: I created the following array, and I want to use np.where for multiple condition judgments
import numpy as np
a = np.array( [1,2,3,4,5,6] )
b = np.array( [4,5,8,9,7,9])
I want to get a subscript that meets the conditions, but an error occurs
index = np.where(a >1 and b != 2 and a < 6)
The error is as follows:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
I don't want to use np.logical_and() , what is the solution? Thanks a lot!
I have met a issue. For example: I created the following array, and I want to use np.where for multiple condition judgments
import numpy as npa = np.array( [1,2,3,4,5,6] )b = np.array( [4,5,8,9,7,9])I want to get a subscript that meets the conditions, but an error occurs
index = np.where(a >1 and b != 2 and a < 6)The error is as follows:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()I don't want to use
np.logical_and(), what is the solution? Thanks a lot!