Hi, Can anyone help me out with a simple way to vectorize this loop? # idx and vals are arrays with indexes and values used to update array data # data = numpy.ndarray(shape=(100,100,100,100), dtype='f4') flattened = data.ravel() for i in range(len(vals)): flattened[idx[i]]+=vals[i] Many thanks! Stephen