[Numpy-discussion] Re: ndarray.fill and ma.array.filled
efiring at hawaii.edu
Fri Apr 7 13:22:06 CDT 2006
> 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
> 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.
I agree strongly with you, Sasha. I get the impression that the world
of numerical computation is divided into those who work with idealized
"data", where nothing is missing, and those who work with real
observations, where there is always something missing. As an
oceanographer, I am solidly in the latter category. If good support for
missing values is not built in, it has to be bolted on, and it becomes
clunky and awkward. I was reluctant to speak up about this earlier
because I thought it was too much to ask of Travis when he was in the
midst of putting numpy on solid ground. But I am delighted that missing
value support has a champion among numpy developers, and I agree that
now is the time to change it from "bolted on" to "integrated".
More information about the Numpy-discussion