2008/11/27 Robert Ferrell <[EMAIL PROTECTED]>: > I have a question about assigning to masked arrays. a is a len ==3 > masked array, with 2 unmasked elements. b is a len == 2 array. I > want to put the elements of b into the unmasked elements of a. How do > I do that? > > In [598]: a > Out[598]: > masked_array(data = [1 -- 3], > mask = [False True False], > fill_value=999999) > > > In [599]: b > Out[599]: array([7, 8]) > > I'd like an operation that gives me: > > masked_array(data = [7 -- 8], > mask = [False True False], > fill_value=999999) > > Seems like it shouldn't be that hard, but I can't figure it out. Any > suggestions?
How about: c = a.copy() c[~a.mask] = b Angus. -- AJC McMorland Post-doctoral research fellow Neurobiology, University of Pittsburgh _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
