[Numpy-discussion] Unexpected MaskedArray behavior

Ryan May rmay31@gmail....
Tue Dec 16 12:57:40 CST 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