Ian Mallett wrote: > > To the second, actually, I need to increment the number of times the > index is there. For example, if b=[1,5,6,6,6,9], then a[6-1] would have > to be incremented by +3 = +1+1+1. I tried simply a[b-1]+=1, but it > seems to only increment values once, even if there are more than one > occurrence of the index in "b". What to do about that?
Is this what you mean? >>> numpy.bincount( [1,5,6,6,6,9] ) array([0, 1, 0, 0, 0, 1, 3, 0, 0, 1]) HTH, Jon _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
