[Numpy-discussion] Question about recarray

Robert Kern robert.kern at gmail.com
Fri Sep 22 04:06:36 EDT 2006


Lionel Roubeyrie wrote:
> good news, and thanks for your last comment. However, using nans give some 
> errors with scipy.stats:
> lionel52>t=array([1,2,nan,4])
> 
> lionel53>stats.nanmean(t)
> ---------------------------------------------------------------------------
> exceptions.NameError                                 Traceback (most recent 
> call last)
> 
> /home/lionel/<ipython console>
> 
> /usr/lib/python2.4/site-packages/scipy/stats/stats.py in nanmean(x, axis)
>     258
>     259     # XXX: this line is quite clearly wrong
> --> 260     n = N-sum(isnan(x),axis)
>     261     putmask(x,isnan(x),0)
>     262     return stats.mean(x,axis)/factor
> 
> NameError: global name 'N' is not defined

It's a bug in nanmean() as the comment immediately preceding it mentions. I 
don't know who put it in, but I noticed it and couldn't figure out what it 
intended to do (or didn't have to time to try).

<Looks at svn blame and svn log> Ah, it's Travis's fault. So he can fix it.  :-)

-- 
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 NumPy-Discussion mailing list