[Numpy-discussion] bug in numpy.where?

Phil Hodge hodge at stsci.edu
Mon Jul 30 09:30:46 EDT 2012


On 07/27/2012 03:58 PM, Andreas Mueller wrote:
> Hi Everybody.
> The bug is that no error is raised, right?
> The docs say
>
> where(condition, [x, y])
>
> x, y : array_like, optional
>       Values from which to choose. `x` and `y` need to have the same
>       shape as `condition`
>
> In the example you gave, x was a scalar.

net.max() returns an array:

 >>> print type(net.max())
<type 'numpy.float32'>

That was the reason I cast it to a float to check that that did result 
in the correct behavior for `where`.

Phil



More information about the NumPy-Discussion mailing list