NaN handling

Robert Kern robert.kern at gmail.com
Wed May 3 13:08:08 EDT 2006


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

How do you want to handle them? But you will be better off asking on the numpy
or scipy lists:

  http://scipy.org/Mailing_Lists

-- 
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