NaN handling

Grant Edwards grante at visi.com
Wed May 3 13:22:02 EDT 2006


On 2006-05-03, Andy McDonagh <andymcdonagh at earthlink.net> wrote:
> Dear python experts,
>
> I am new to python and this site, so I apologize if this is off topic (i.e. is it a SciPy question?). I will try to demonstrate my problem below:
> --------------------------------------------------------
> #!/usr/local/bin/python
>
> from scipy import *
> from scipy.stats import *
> a=norm(loc=0,scale=1)
> a_data = a.rvs(10)
>
> problem = zeros(10)
> print problem
>
> h_x1_x2 = -sum(problem * log2(a_data))
>
> print h_x1_x2
> #NaN
> ----------------------------------------------------------
>
> I need a way of handling NaNs

NaNs are handled.

Apparently they aren't handled the way you want them to be?

> for example R has the 'na.omit' option. Does anybody know if
> this exists?

It would help if you explain how you want NaNs handled, but I
don't recall that tehre are any "options" for handling NaNs
other than the default way in scipy.

-- 
Grant Edwards                   grante             Yow!  It's NO USE... I've
                                  at               gone to "CLUB MED"!!
                               visi.com            



More information about the Python-list mailing list