[Numpy-discussion] min bug

Neil neilcrighton@gmail....
Tue Nov 17 03:47:43 CST 2009


Alan McIntyre <alan.mcintyre <at> gmail.com> writes:

> 
> On Mon, Nov 16, 2009 at 11:34 PM, "V. Armando Solé" <sole <at> esrf.fr> wrote:
> > Sebastian Berg wrote:
> >> Known issue, I think someone posted about it a while ago too. The numpy
> >> min is array aware, and it expects an array. The second argument is the
> >> axis, which in the case of a single number doesn't matter.
> >
> > I think I have to agree with the original poster.
> >
> > It would be more correct to rise an exception because the axis is beyond
> > the number of axes than to return a confusing result.
> 
> Hm, now that I actually try my example
> 
>     min((5000,), 4)
> 
> it fails with an axis out of bounds error.  I presume there's a reason
> why a 0-D array gets special treatment?
> 

In [16]: import numpy as np
In [17]: np.__version__ 
Out[17]: '1.4.0.dev7746'
In [18]: np.min(5000, 4)
...
ValueError: axis(=4) out of bounds


Neil



More information about the NumPy-Discussion mailing list