[SciPy-user] array mean issue...

fred fredmfp@gmail....
Wed Jun 11 09:47:05 CDT 2008

Sebastian Stephan Berg a écrit :
> I am not familiar with things really, but looking at ??nansum code:
> def nansum(a, axis=None):
>     """Sum the array over the given axis, treating NaNs as 0.
>     """
>     y = array(a,subok=True)
>     if not issubclass(y.dtype.type, _nx.integer):
>         y[isnan(a)] = 0
>     return y.sum(axis)
> If this is all there is to nansum, you can just do this small
> replacement with y[isnan[a]] = 0 and your special values including the
> isnan, and then again use sum with a more precise dtype.
Ok, thanks to all of you.

I'll look at it asap.

However, I wonder why there is no nan*** methods related to arrays,
like array.mean(), array.min(), etc.
And also why there is no nanmean & nanstd method...



More information about the SciPy-user mailing list