[Numpy-discussion] median object
Tue Jul 7 20:04:07 CDT 2009
On Mon, Jul 6, 2009 at 18:00, keflavich<email@example.com> wrote:
> Hi, I want to be able to do something like:
> import numpy
> rather than
> so that in a function, I can call
> and allow x to be a masked array or a numpy array.
> Using the ma.median version by default is something of a workaround, because
> it appears to work on both numpy arrays and masked arrays. My question,
> though, is: why is median() not implemented as an attribute of the
> array/masked array object, while min/max/mean/std are? Is there a better
You may want to consider using simplegeneric to make a generic
function that will dispatch to the type-appropriate implementation.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion