Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python pandas cumulative return

#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()
Comment

PREVIOUS NEXT
Code Example
Python :: python count lines in string 
Python :: what is a module computer science 
Python :: torch save 
Python :: image in tkinter 
Python :: filter list dict 
Python :: create np nan array 
Python :: python get current user windows 
Python :: convert base64 to image python 
Python :: pyqt expressions 
Python :: decode base64 with python 
Python :: read text from a pdffile python 
Python :: import counter python 
Python :: python get all ips in a range 
Python :: pyhton turtle delete 
Python :: python exceute 60 records per minute counter 
Python :: scanning 2d array in python 
Python :: value_counts to list 
Python :: python truncate to integer 
Python :: get gpu name tensorflow and pytorch 
Python :: sqlalchemy validation 
Python :: pil overlay images 
Python :: pandas correlation 
Python :: Install Basemap on Python 
Python :: sort array python by column 
Python :: python order 2d array by secode element 
Python :: all possible combinations of parameters 
Python :: pandas display only certain columns 
Python :: flask debug 
Python :: python maths max value capped at x 
Python :: how to remove duplicate files from folder with python 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =