On Saturday, February 23, 2013 00:45:55 Brett Olsen wrote:
> a = np.ones(30)
> idx = np.array([2, 3, 2])
> a += 2 * np.bincount(idx, minlength=len(a))
> 
> >>> a
> 
> array([ 1.,  1.,  5.,  3.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
>         1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
>         1.,  1.,  1.,  1.])
> 


Hi!
OK, but is there any reason why Santhu's first option doesn't work? Shouldn't 
it work? 
Cheers,
Ze
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to