Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Correlation for two Securities (pearsonr syntax help)

Is there a way to mask the pearsonr factor for a single security?

Something like:

returns = Returns(window_length=30)  
aapl_returns = returns[sid(24)] #aapl  
corr = returns.pearsonr(target=aapl_returns, correlation_length=20, mask=sid(8554)) # this is where I need some help  

I currently have it going through pipeline, but I have two issues with that: First, I would only like the correlations with the one security, so any computation on other securities is just time wasted in backtesting; Second, I'm not sure how to slice pipeline_output to get just the security I want.

Any help would be great!