【发布时间】:2018-09-03 18:28:55
【问题描述】:
比如我有一个数组X = np.array([1,-3,5,0,9,12])
我想做一个这样的函数。
def bigfunction(X)
if X<0:
return 99
if X=>0 and X<=10
return 100
if X>10
return 101
它还返回一个数组。在这种情况下[100,99,100,100,100,101]
很明显,这段代码是行不通的。
我不能循环执行它是非常重要的。我想知道是否已经在 numpy 中实现了代码来解决这个问题。
【问题讨论】: