[Numpy-discussion] Bug in digitize function

Stefan van der Walt stefan at sun.ac.za
Fri Jun 30 07:24:58 CDT 2006


Hi David

On Thu, Jun 29, 2006 at 02:42:51PM -0400, David Huard wrote:
> Here is something I noticed with digitize() that I guess would qualify as a
> small but annoying bug.
> 
> In [165]: x = rand(10); bin = linspace(x.min(), x.max(), 10); print x.min();
> print bin[0]; digitize(x,bin)
> 0.0925030184144
> 0.0925030184144
> Out[165]: array([2, 9, 5, 9, 6, 1, 1, 1, 4, 5])
> 
> In [166]: x = rand(10); bin = linspace(x.min(), x.max(), 10); print x.min();
> print bin[0]; digitize(x,bin)
> 0.0209738428066
> 0.0209738428066
> Out[166]: array([ 5,  2,  8,  3,  0,  8,  9,  6, 10,  9])

Good catch! Fixed in SVN (along with docstring and test).

Cheers
Stéfan




More information about the Numpy-discussion mailing list