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

Best,

Matthew
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to