Python Forum
Calculate column with cumulative return
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calculate column with cumulative return
#1
Hello,

I have a very basic question and would appreciate any help.

I have a column with percentage changes on a daily basis for the last 100 days. Now I'd like to calculate a new column that shows the cumulative return for each day, i.e. for day 3 it would be: % change day 1* % change day 2 * % change day 3.

In Excel this task would be very simple, but in Python I have no idea how to solve this.

I'd be happy if someone could please help me.

Many thanks,

Tim
Reply
#2
https://pandas.pydata.org/pandas-docs/st...mprod.html

just to mention if you have percentage change - you need to calculate (1+day1%)*(1+day2%)*(1*day3%)-1 for accurate results
for a ballpark estimate you can have day1%+day2%+day3 but it will be inaccurate
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I calculate a ratio from 2 numbers and return an equivalent list of about 1000 Pleiades 8 15,440 Jan-05-2024, 08:30 PM
Last Post: sgrey
  calculate daily return in percent in forex as to some strategy? alen 1 2,181 Mar-12-2021, 10:03 AM
Last Post: buran
  How to calculate column mean and row skip non numeric and na Mekala 5 4,833 May-06-2020, 10:52 AM
Last Post: anbu23
  How to calculate unique rows column sum and percentage SriRajesh 4 3,395 Feb-12-2020, 02:21 PM
Last Post: SriRajesh
  How to calculate variance(standard deviation) by column SriRajesh 2 2,800 Dec-27-2018, 12:35 PM
Last Post: SriRajesh
  Need help for finding cumulative values in a loop Lightning1800 10 6,009 May-23-2018, 07:48 PM
Last Post: Lightning1800

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020