From: Sasha <nd...@ma...> - 2006-05-02 02:06:20
|
Do we really need the putmask method? With fancy indexing the obvious way to do it is >>> a[a>3] =3D 3 and it works fine. Maybe we can drop putmask method before 1.0 instead of fixing the bug. On 5/1/06, Christopher Barker <Chr...@no...> wrote: > Hi all, > > I was just trying to use the putmask() method to replace a bunch of > values with the same value and got and error, where the putmask() > function works fine: > > >>> import numpy as N > >>> a =3D N.arange(5) > >>> a > array([0, 1, 2, 3, 4]) > >>> a.putmask(a > 3, 3) > Traceback (most recent call last): > File "<stdin>", line 1, in ? > ValueError: putmask: mask and data must be the same size > > >>> N.putmask(a, a > 3, 3) > >>> a > array([0, 1, 2, 3, 3]) > > and: > > >>> help (N.ndarray.putmask) > putmask(...) > a.putmask(values, mask) sets a.flat[n] =3D v[n] for each n where > mask.flat[n] is TRUE. v can be scalar. > > indicates that it should work. > > -Chris > > > -- > Christopher Barker, Ph.D. > Oceanographer > > NOAA/OR&R/HAZMAT (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > Chr...@no... > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job ea= sier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > |