[Numpy-discussion] Unexpected MaskedArray behavior

Ryan May rmay31 at gmail.com
Tue Dec 16 13:57:40 EST 2008


Hi,

I just noticed the following and I was kind of surprised:

 >>>a = ma.MaskedArray([1,2,3,4,5], mask=[False,True,True,False,False])
 >>>b = a*5
  >>>b
masked_array(data = [5 -- -- 20 25],
       mask = [False  True  True False False],
       fill_value=999999)
  >>>b.data
array([ 5, 10, 15, 20, 25])

I was expecting that the underlying data wouldn't get modified while masked.  Is 
this actual behavior expected?

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma



More information about the NumPy-Discussion mailing list