[Numpy-discussion] Masked array usage

Robert Ferrell ferrell at diablotech.com
Thu Nov 27 10:14:03 EST 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