vals = pd.Series([1,3,2,5,3,1,2])
fv = 6
def cumscums(vals, fv = fv):
vals_ = []
vals_.append(vals[0])
vals = vals[1:]
for ind,line in enumerate(vals, start=1):
if vals_[ind-1] < fv:
vals_.append(vals_[ind-1] + line)
else:
vals_.append(line)
return vals_
ccc = cumscums(vals, fv = fv)
pd.Series(ccc)