I would like to sum up all the values in an array till a given percentile. E.g.
import numpy as np
a = [15, 40, 124, 282, 914, 308]
print np.percentile(a,90)
The 90th percentile is ~611 and the cumulative sum till then is 461
Is there any function in Python which can do that?