[Numpy-tickets] [NumPy] #632: numpy.histogram fails with bin=<list>

NumPy numpy-tickets@scipy....
Mon Dec 17 11:27:28 CST 2007


#632: numpy.histogram fails with bin=<list>
-----------------------+----------------------------------------------------
 Reporter:  orbeckst   |       Owner:  somebody 
     Type:  defect     |      Status:  new      
 Priority:  normal     |   Milestone:  1.0.5    
Component:  numpy.lib  |     Version:  none     
 Severity:  normal     |    Keywords:  histogram
-----------------------+----------------------------------------------------
 numpy.histogram() in 1.0.4 (with python 2.3) fails if the argument to bins
 is a list:

 1) any() is not found[[BR]]
 2) exception at line 155, {{{if(any(bins[1:]-bins[:-1] < 0)):}}}

 Solution: two changes in ''numpy/lib/function_base.py'':

 1) add
 {{{
 from numpy.core import any
 }}}
 at the top of the file[[BR]]
 2) change line 155 from[[BR]]
 {{{
 if(any(bins[1:]-bins[:-1] < 0)):
 }}}
 to
 {{{
 if(any(asarray(bins[1:])-asarray(bins[:-1]) < 0)):
 }}}

-- 
Ticket URL: <http://scipy.org/scipy/numpy/ticket/632>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list