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