Back to Community
Betas in the risk model return as inf or nan


Has anyone run into an issue with the risk betas returning inf or nan? I'm having a hard time fixing this issue.

ValueError: NaN or Inf values provided to FactorExposure for argument 'loadings'.
Rows/Columns with NaNs:
row=Equity(33655 [HYG]) col='momentum'
row=Equity(33655 [HYG]) col='short_term_reversal'
row=Equity(33655 [HYG]) col='size'
row=Equity(33655 [HYG]) col='value'
row=Equity(33655 [HYG]) col='volatility'
Rows/Columns with Infs:

It occurs around July 2007 as part of a weekly rebalance. I've tried this:
context.risk_factor_betas = pipeline_output('risk_pipe').replace([-np.inf,np.inf],np.nan).dropna()

1 response

Hi David.

Try this :
context.risk_factor_betas = pipeline_output('risk_pipe').dropna()