NaN handling

Andy McDonagh andymcdonagh at earthlink.net
Wed May 3 13:00:28 EDT 2006


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  for example R has the 'na.omit'  option. Does anybody know if this exists?

Many thanks

Andy







More information about the Python-list mailing list