Dec-17-2020, 06:05 PM
This line of code is giving a Traceback:
This df currently has only column ('Close') with a datetime index. What I'm trying to do is create a new column 'Pct_Return' that reflects percentage change since the beginning of the period. I'm therefore trying to fix the first date by selecting the zero index of the column.
What did I do wrong? Thanks!
ES_skel['Pct_Return']=100*(ES_skel['Close']-ES_skel['Close'][0])/ES_skel['Close'][0]The IndexError is "index 0 is out of bounds for axis 0 with size 0."
This df currently has only column ('Close') with a datetime index. What I'm trying to do is create a new column 'Pct_Return' that reflects percentage change since the beginning of the period. I'm therefore trying to fix the first date by selecting the zero index of the column.
What did I do wrong? Thanks!