[Numpy-discussion] Boolean indexing

Sam Tygier Sam.Tygier at hep.manchester.ac.uk
Tue Mar 8 09:53:29 EST 2011


2011-03-08 14:29:07 GMT, Sturla Molden:
>A "boolean slice" cannot be indexed with the dot product of dimensions 
and strides, hence the copy.
>You probably want to use masked arrays instead.

Masked array does not seem to help. when i do:
am = numpy.ma.array(a, mask=a[n]['name']=="foo")
am['x'] += 1

then it modifies all the elements, not just the unmasked ones.

sam




More information about the NumPy-Discussion mailing list