ignoring NAs in a dataset with numpy
Robert Kern
robert.kern at gmail.com
Tue Oct 28 15:34:43 EDT 2008
mrafi wrote:
> Hey All,
> I am working with numpy
> I have a data set with a lot of nan values, and i want to calculate standard
> deviation
> is there a direct function to do it for example nansum(or something like
> this),
> to calculate standard deviation ignoring nan values??
You will want to ask numpy questions on the numpy-discussion mailing list.
http://www.scipy.org/Mailing_Lists
scipy.stats.nanstd() implements this. Additionally, data[~isnan(data)].std()
works unless if you need to apply the std() along just one axis.
--
Robert Kern
"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 Python-list
mailing list