[Numpy-discussion] Masked array fill_value
Sat Jul 19 16:21:04 CDT 2008
Ryan May wrote:
> I just noticed this and found it surprising:
> In : from numpy import ma
> In : a = ma.array([1,2,3,4],mask=[False,False,True,False],fill_value=0)
> In : a
> masked_array(data = [1 2 -- 4],
> mask = [False False True False],
> In : a
> masked_array(data = --,
> mask = True,
> In : np.__version__
> Out: '1.1.0'
> Is there a reason that the fill_value isn't inherited from the parent array?
There was a thread about this a couple months ago, and Pierre GM
explained it. I think the point was that indexing is giving you a new
masked scalar, which is therefore taking the default mask value of the
type. I don't see it as a problem; you can always specify the fill
value explicitly when you need to.
More information about the Numpy-discussion