how to do such calculation task in pandas?

try this:

In [17]: df.val.cumprod()
Out[17]:
a      1
b      2
c      6
d     24
e    120
Name: val, dtype: int64

Leave a Comment