Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Confused about use of panels on research platform

I'm researching an algorithm that uses fundamental data to calculate a ranking of stocks that (I hope) will correlate with future returns. As I need two years of data to calculate some of the ratios, and as I'm pulling multiple fundamentals for all companies, my query fundamentals function returns a 3D pandas panel. I'm finding it difficult to figure out how to manipulate the panel. I understand the basics of dataframes, but there seems to be few panel methods available in pandas and little documentation of how to work with panels. Can anyone point me to a resource (tutorial, documentation, algo notebook)? If not, is there anything of a general nature on using the Research platform to work with financial ratios?

1 response

I couldnt be bothered to work with the panels, I find it more convenient to loop over multiple requests.

You can do longitudinal ratios etc by running your first query on your normal criteria 'today', then run a second query for two years ago which filters based on sid isin(firstDF.index), assuming you've transposed the data frame.