import numpy as np # Create a new C array with different values C = np.bincount([2,2,2,4,4,6,8,8,8,8,8]) A = np.repeat(np.arange(len(C)), C) print(A)