Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Newbie - simple pipeline question - screening by industry

Hello!
how would I use pipeline to screen out everything except for one industry? For example, polymer companies or pharma?
the pipeline tutorials I've found give examples of everything BUT this, it seems.

Thanks!!

2 responses

Maybe take a look at this post for ideas https://www.quantopian.com/posts/how-can-i-implement-specific-sectors-in-my-pipeline-as-a-filter

The Morningstar industry codes are here https://www.quantopian.com/help/fundamentals#industry-sector

So to filter for a specific industry, create a classifier using the .latest method then create a filter from that.

import quantopian.pipeline.data.morningstar as ms  
drug_companies = ms.asset_classification.morningstar_industry_group_code.latest.element_of([20636])

Thanks!! I really appreciate it. Heres what I eventually did. Works great.

def make_pipeline():
drug_companies = ms.asset_classification.morningstar_industry_group_code.latest.element_of([20636])

return Pipeline(  
    columns={  
        'sector_code': Sector(),  
    },  
    screen=(drug_companies)  
)