MCPcopy Index your code
hub / github.com/QuantFans/quantdigger / accumulate

Function accumulate

quantdigger/widgets/mplotwidgets/stock_plot.py:14–24  ·  view source on GitHub ↗

Return running totals

(iterable, func=operator.add)

Source from the content-addressed store, hash-verified

12#mpl.rcParams['font.sans-serif'] = ['Microsoft YaHei'] #ָ��Ĭ������
13
14def accumulate(iterable, func=operator.add):
15 'Return running totals'
16 # accumulate([1,2,3,4,5]) --> 1 3 6 10 15
17 # accumulate([1,2,3,4,5], operator.mul) --> 1 2 6 24 120
18 it = iter(iterable)
19 total = next(it)
20 #rst = []
21 yield total
22 for element in it:
23 total = func(total, element)
24 yield total
25
26font = FontProperties(size=8)
27font_big = FontProperties(size=14)

Callers 1

plot_contributionFunction · 0.85

Calls 1

nextFunction · 0.85

Tested by

no test coverage detected