Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Looping through a custom factor and adding each output to a pandas dataframe?

Hi,

I have a custom factor that calculates the average PE of each sector. I then want to calculate the average PE for each sector for the past 10 years. How could I go about doing this?

I'm thinking the column headers would be the years(windows_length=1,365,730,etc..) and the rows would be the name of the industry. I don't want to just get the average PE for the past 10 years I would like each year individually.

Thanks