You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
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!The text was updated successfully, but these errors were encountered: