![](https://secure.gravatar.com/avatar/764323a14e554c97ab74177e0bce51d4.jpg?s=120&d=mm&r=g)
Jan. 23, 2009
7:42 a.m.
On Fri, Jan 23, 2009 at 01:39, Matthew Brett <matthew.brett@gmail.com> wrote:
Hi,
#This does not work import numpy a=numpy.zeros(10) b=numpy.ones(4, numpy.int) a[b] += 1
The problem here is that you are setting a[1] to a[1]+1.
I think you want:
import numpy a=numpy.zeros(10) b=numpy.ones(4, numpy.bool) a[b] += 1
Judging from his for loop, he does want the integer array. He's doing something like histogramming. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco