Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
filters vs booleans?

In this example, why is it that market_cap_filter is a NumExprFilter but is_bio_filter is False. I currently expect them to both be the same type of value since they're both the result of an equivalency operation.

Thanks!

1 response

There are some nuances/limitations on how to make filters. Basically, in this case the '==' operand isn't supported. See the documentation https://www.quantopian.com/help#quantopian_pipeline_filters_Filter . Also note that technically 'industry_code' is a classifier which have their own set of methods. What you would perhaps want to use is the '.eq' method.

  is_bio_filter     = industry_code.eq(20635084)

Another more general method is '.element_of'. This is nice because one could check for inclusion in a list of values.

  is_bio_filter     = industry_code.element_of([20635084])

Combined with the not ( ~ ) operator this can be pretty powerful.

  is_not_bio_filter     =  ~industry_code.element_of([20635084])

Good luck.