[SciPy-user] arrays mean & NaN...
Tue Sep 18 02:23:08 CDT 2007
David Cournapeau a écrit :
> Wolfgang Kerzendorf wrote:
>> It would be a very good idea, I use nan very often and have trouble when
>> computing the mean. I think it would be better to have a switch in the
>> mean function to switch to ignoring nans. Could that be implemented in
>> other funtions like squaresum (ss) as well?
> The nanmean, nanmedian and nanstd already exist, but for some reason are
> not exposed at the package module:
> from scipy.stats.stats import nanmean, nanmedian, nanstd
> import numpy as N
> a = N.array([1., 2., N.nan])
> N.mean(a) # -> returns Nan
> nanmean(a) # -> returns 1.5, treating Nan as a missing value
So, shall we do wait for it to be implemented in numpy
or use it as it is in scipy.stats ?
Eric said that they want to put it in numpy IIUC.
But... when ? ;-)
More information about the SciPy-user