[Scipy-tickets] [SciPy] #303: scipy.stats histogram binning error - found and fixed problem with small numbers

SciPy scipy-tickets at scipy.net
Sun Nov 5 09:21:31 CST 2006


#303: scipy.stats histogram binning error - found and fixed problem with small
numbers
--------------------+-------------------------------------------------------
 Reporter:  zunzun  |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  normal  |   Milestone:          
Component:  Other   |     Version:          
 Severity:  normal  |    Keywords:          
--------------------+-------------------------------------------------------
 In the scipy.stats histogram() function, the estimated bin width
 calculation:
 {{{
 estbinwidth = float(Max - Min)/float(numbins) + 1
 }}}
 should be dividing by float(numbins + 1).

 To test this use the following code:
 {{{
 import scipy
 rawData = [1E-6, 2E-6, 3E-6, 4E-6, 5E-6, 6E-6, 7E-6, 8E-6, 9E-6]
 print scipy.stats.histogram(rawData, 6)
 }}}
 which incorrectly puts all of the values in a single histogram bin.

-- 
Ticket URL: <http://projects.scipy.org/scipy/scipy/ticket/303>
SciPy <http://www.scipy.org/>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list