[Numpy-discussion] Masked array usage

Robert Ferrell ferrell@diablotech....
Thu Nov 27 09:14:03 CST 2008


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?

thanks,
-robert


More information about the Numpy-discussion mailing list