[Numpy-discussion] Histogram versus histogram2d

David Huard david.huard at gmail.com
Mon Aug 7 07:48:52 CDT 2006

I have noticed some that the 1d histogram and 2d histogram.  The

> histogram function bins everything between the elements of edges, and
> then includes everything greater than the last edge element in the
> last bin.  The histrogram2d function only bins in the range specified
> by edges.  Is there a reason these two functions do not operate in the
> same way?

Hi Mikolai,

The reason is that I didn't like the way histogram handled outliers so I
wrote histogram1d, histogram2d, and histogramdd to handle 1d, 2d and nd data
series. I submitted those functions and only histogram2d got included in
numpy, hence the clash. Travis suggested that histogram1d and histogramdd
could go into scipy, but with the new compatibility paradigm, I suggest that
the old histogram is moved into the compatibility module and histogram1d is
renamed to histogram and put into the main namespace. histogramdd could
indeed go into scipy.stats. I'll submit a new patch if there is some

The new function takes an axis argument so you can make an histogram out of
a nd array rowwise or columnwise. Ouliers are not counted, and the bin array
has length (nbin +1) (+1 for the right hand side edge). The new function
will break some code relying on the old behavior, so its inclusion
presupposes the agreement of the users. You can find the code at
ticket 189<http://projects.scipy.org/scipy/numpy/ticket/189>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060807/a1d025ff/attachment-0001.html 

More information about the Numpy-discussion mailing list