Back to Community
New Pipeline Features: fillna, if_else, and Row-Wise Computations.

Hi everyone,

We recently added a number of methods to pipeline that should make it easier to perform certain computations. Here is a list of the methods that were recently added, with links to their respective entries in the API reference:
- Factor.fillna
- Classifier.fillna
- Filter.if_else
- Factor.sum
- Factor.mean
- Factor.median
- Factor.notnull_count
- Factor.stddev
- Factor.max
- Factor.min

{Factor|Classifier}.fillna is useful when combining factors. Filter.if_else is useful if you want to switch between two pipeline terms depending on the result of a filter. For instance, you might define a filter to detect regimes for a particular asset and pick between two different factor definitions depending on which regime the asset is in.

Factor.{sum|mean|median|notnull_count|stddev|max|min} are different than other Factor methods in that they are row-wise operations. This means that they compute aggregations across assets each day, producing a scalar output. An example use case for this type of computation is transforming factor scores into weights. There is a new cookbook entry that demonstrates how Factor.sum can be used to achieve this transformation. There is also a new subsection in the Pipeline User Guide that further discusses row-wise computations in pipeline.

Hopefully this makes it easier to define common computations with less boilerplate code!



The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

1 response

This is great, thank you guys! Makes it easier to do more complicated computations on factors and write lesser, buggy boilerplate code.