a = np.arange(100)
breaks = np.linspace(0, 100, 11, dtype=np.intp)
counts = np.diff(breaks)
counts
sums = np.add.reduceat(a, breaks[:-1], dtype=np.float)
sums
sums / counts
Vectorizing a Numpy slice operation