让我们说,我们有一个数组如何根据其相对值操作numpy数组的每个元素?
a = np.array([10,30,50, 20, 10, 90, 0, 25])
的伪代码,因为我想要的东西 -
if a[x] > 80 then perform funcA on a[x]
if 40 < a[x] <= 80 then perform funcB on a[x]
if a[x] <= 40 then perform funcC on a[x]
什么是使用numpy的函数来执行这个干净的方式?
`funcA()`等可以用NumPy ufuncs表示吗?这些功能是做什么的? – 2010-12-09 17:15:36
地图怎么样? – nmichaels 2010-12-09 17:18:23