On Thu, Jul 14, 2011 at 4:09 AM, Marcin Wlodarczak < mwlodarc...@uni-bielefeld.de> wrote:
> > Hi, > > I was wondering whether it is possible to mask specific entries in a > structured array. If I try to do the following: > > x = ma.masked_array([(2, 1.), (8, 2.)], dtype=[('a',int), ('b', float)]) > x_masked = ma.masked_equal(x, 2) > > I get "AttributeError: 'NotImplementedType' object has no attribute > 'ndim'", which actually makes sense since x.shape returns (2,). I really > can't think of any way around this problem. > > It's not terribly satisfying, but you can iterate over the field names. for field in x.dtype.names: x[field] = np.ma.masked_equal(x[field],2) -Chris Jordan-Squire > Best regards, > Marcin _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion