Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Having an issue with creating a Filter to be applied as a screen

Hi all,
Been attempting to weed out stocks that are not associated with the Morningstar sector code of 103 (Financial Institutions... codes given as per this post), but have also receiving an error message specifying that Filters used in the screen argument of creating a pipeline have to be either NoneType or a Filter object, rather than a boolean which is what is produced.
However, as per Quantopian tutorials, a boolean should work (final example). Does a Factor need to be involved? What separates the boolean in Lesson 5 that's used in the screen argument from mine? How can I fix this?

2 responses

Hi,

Since 103 is a sector code, you need to use "morningstar_sector_code". To create a filter, use .eq(103). then exclude the sector with ~
Here is the corrected code

Thank you... quick correction for any others though. I was trying to weed out everything besides the 103 sector code, so in this case, I would not use the ~ to flip the boolean,