Tue Jun 2 16:58:25 CDT 2009
On Tue, Jun 2, 2009 at 16:20, ctw <email@example.com> wrote:
>> Please revert that.
> Done! Sorry about that. I am having some issues with the current
> behavior of changing all inputs to ndarrays. Would it be possible to
> add a nanmean function to numpy that behaves just as np.nansum in the
> sense that it preserves the type of the input?
I would prefer a comprehensive approach rather than hacking in the one
function you want. I wouldn't be opposed to more NaN-aware functions
in numpy if they were corralled into their own module. However, that
leaves all of the rest of scipy.stats untouched.
Alternately, you could help write a decorator that would wrap a
function to cast its arguments to ndarrays (bonus points: any
specified subclass) and then cast the result(s) back to the
appropriate subclass determined by the inputs' classes according to
the ufunc rules. You just have to be careful to deal with functions
that take multiple arraylike and non-arraylike inputs and return
multiple outputs (some of which aren't arraylike, either). This would
take some care, but would be a great asset to numpy.
"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 Scipy-dev