Python Pandas Skumulowany powrót
#We calculate and plot the cumulative return of a given dataframe called data
r = data.pct_change()
r_plus_one = r.add(1)
cumulative_return = r_plus_one.cumprod().sub(1)
cumulative_return.mul(100).plot()
plt.ylabel('Percent')
plt.legend(['Cumulative Return'])
plt.show()
M.U