[Numpy-discussion] changed behavior of numpy.histogram

Stuart Brorson sdb@cloud9....
Wed Jan 23 11:14:17 CST 2008


Hi --

> Greetings:  I just noticed a changed behavior of numpy.histogram.  I
> think that a recent 'fix' to the code has changed my ability to use that
> function (albeit in an unconventional manner).

You can blame me for this.  I submitted a patch which prohibited the
user from entering any range into histogram other than a monotonically
increasing one.  The ticket with the info is:

http://scipy.org/scipy/numpy/ticket/586

This patch was apparently applied by the NumPy folks, and it broke
your code.  Sorry!

> Is this something that can possibly be fixed (should I submit a ticket)?
>  Or should I revert to some other approaches for implementing the same
> idea?  It really was a nice convenience.  Or, alternately, would some
> sort of new function along the lines of a numpy.countunique() ultimately
> be useful?

IMO, your use was invalid (albeit a cute and useful shortcut).
Allowing non-monotonically increasing bins can lead to confusing or
inexplicable results.

On the other hand, I would support the idea of a new function
numpy.countunique() as you suggest.

Just my two cents...

Stuart Brorson
Interactive Supercomputing, inc.
135 Beaver Street | Waltham | MA | 02452 | USA
http://www.interactivesupercomputing.com/



More information about the Numpy-discussion mailing list