From: Janko H. <jh...@if...> - 2000-10-13 23:14:14
|
You do not define, what values are in z,y if x < 0, so I presume, they keep the current value. >>> true = greater(x,0.) >>> z=where(true, u+2., z) >>> y=where(true, v, y) HTH, __Janko Daehyok Shin writes: > What is the best Numpy way for the following work? > > for i in range(len(x)): > if x[i] > 0: > y[i] = v[i] > z[i] = u[i]+2 > > Daehyok Shin (Peter) > > > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > http://lists.sourceforge.net/mailman/listinfo/numpy-discussion |