On 01/10/15 21:45, Paulo da Silva wrote: > Hi all. > > What is the fastest way to do the following: > > I have an initial value V and a vector vec of (financial) indexes. > I want to generate a new vector nvec as > > V, V*vec[0], V*vec[0]*vec[1], V*vec[0]*vec[1]*vec[2], ... > > A numpy vectorized solution would be better. > > Thanks >
Maybe, http://docs.scipy.org/doc/numpy/reference/generated/numpy.cumprod.html Duncan -- https://mail.python.org/mailman/listinfo/python-list