numpy中有这些功能的相应方法吗?
def arg_less(inarray,threshold):
return np.nonzero(inarray<threshold)
def arg_greater(inarray,threshold):
return np.nonzero(inarray>threshold)
def arg_between(inarray,lowerbound,upperbound):
if lowerbound>=upperbound:
raise ValueError('the first argument is lower bound, lower bound bigger than upper bound!')
else:
return np.nonzero((inarray>lowerbound)|(inarray<upperbound))
def arg_outside(inarray,lowerbound,upperbound):
if lowerbound>=upperbound:
raise ValueError('the first argument is lower bound, lower bound bigger than upper bound!')
else:
return np.nonzero((inarray<lowerbound)&(inarray>upperbound))
感谢所有人。