[Numpy-discussion] Re: ndarray.fill and ma.array.filled

Travis Oliphant oliphant at ee.byu.edu
Mon Apr 10 15:21:07 CDT 2006


Sasha wrote:

>
>
> On 4/7/06, *Tim Hochberg* <tim.hochberg at cox.net 
> <mailto:tim.hochberg at cox.net>> wrote:
>
>     ...
>     In general, I'm skeptical of adding more methods to the ndarray object
>     -- there are plenty already.
>
>
> I've also proposed to drop "fill" in favor of optimizing x[...] = 
> <scalar>.  Having both "fill" and "filled" in the interface is plain 
> awkward.  You may like the combined proposal better because it does 
> not change the total number of methods :-)
>  
>
>     In addition, it appears that both the method and function versions of
>     filled are "dangerous" in the sense that they sometimes return the
>     array
>     itself and sometimes a copy.
>
>
> This is true in ma, but may certainly be changed.
>  
>
>     Finally, changing ndarray to support masked array feels a bit like the
>     tail wagging the dog. 
>
>
> I disagree. Numpy is pretty much alone among the array languages 
> because it does not have "native" support for missing values. For the  
> floating point types some rudimental support for nans exists, but is 
> not really usable.  There is no missing values machanism for integer 
> types.  I believe adding "filled" and maybe "mask" to ndarray (not 
> necessarily under these names) could be a meaningful step towards 
> "native" support for missing values.  

Supporting missing values is a useful thing (but not for every usage of 
arrays).   Thus, ultimately, I see missing-value arrays as a solid 
sub-class of the basic array class.  I'm glad Sasha is working on 
missing value arrays and have tried to be supportive. 

I'm a little hesitant to add a special-case method basically for one 
particular sub-class, though, unless it is the only workable solution.  
We are still exploring this whole sub-class space and have not really 
mastered it...

-Travis





More information about the Numpy-discussion mailing list