Back to Community
Help me on getting monthly returns in a dataframe from a backtest object

Hi!

I would like to have the monthly returns of a simple strategy, which mimics Russell 1000 index, in a dataframe. Here's where I am at now.
But I still couldn't have a structure of this kind.

July 2003 0.022430581132994676
August 2003 0.021828712643752524
September 2003 -0.01012837492538532

and so on...

6 responses

Here's the research notebook

Loading notebook preview...

@Emiliano,

Try this way.

Loading notebook preview...

@Vladimir you really are a Data Scientist!

Is there a way to show the full dataframe?
But not using QGrid, I would like to copy/paste the whole df to Excel.

Things like:

import pandas as pd  
from IPython.display import display  
pd.options.display.max_columns = None  
display(monthly_ret)  

or

from IPython.core.display import HTML  

seem to be blacklisted

@Emiliano,

Try this way.

monthly_ret[:48]  
monthly_ret[48:97]  
monthly_ret[97:145]  
monthly_ret[145:192]  

Great