[SciPy-user] array mean issue...

Sebastian Stephan Berg se.berg@stud.uni-goettingen...
Wed Jun 11 08:36:41 CDT 2008


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.

Regards,

Sebastian



More information about the SciPy-user mailing list