[Numpy-discussion] bug in numpy.where?

Robert Kern robert.kern@gmail....
Mon Jul 30 08:51:42 CDT 2012


On Mon, Jul 30, 2012 at 2:30 PM, Phil Hodge <hodge@stsci.edu> wrote:
> 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'>

No, that's a scalar. The type would be numpy.ndarray if it were an array.

-- 
Robert Kern


More information about the NumPy-Discussion mailing list