Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Alphalens giving 'exog contains inf or nans'

I am trying to build an alphalens tear_sheet but it keeps giving me MissingDataError: exog contains inf or nans even though I don't have any inf or nan in my dataset.

Does anyone know why this is the case? I am doing the substitution like this:

    merged_data = get_clean_factor_and_forward_returns(factor, prices)  
    merged_data = merged_data.replace(['inf','-inf'], np.nan)  
    merged_data.isna().sum()  
    > 1D                 0  
    > 5D                 0  
    > 10D                0  
    > factor             0  
    > factor_quantile    0  
    > dtype: int64  
   create_full_tear_sheet(merged_data)  
    > MissingDataError: exog contains inf or nans  
3 responses

Hi Velociraptor,

Is there any chance you could attach a notebook exhibiting this behavior? I'd love to take a look and try to help debug. Alternatively, you can email in to [email protected] and privately share the notebook with our support team who can take a look.

At first glance, it looks like your code should work but it's possible that something else in the notebook will reveal the issue.

Disclaimer

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.

Has this problem been solved? It occurred to me, too. Thanks!

Ang Li,

As Jamie mentioned above, could you attach a notebook which exhibits this behavior? We can take a look and try to help debug. Alternatively, you can email our support team at [email protected] and privately share the notebook with with them.

Disclaimer

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.