From e1db77fb647b55cb0f46fa3339dadc21d7390103 Mon Sep 17 00:00:00 2001 From: fawce Date: Tue, 19 Jun 2012 17:06:40 -0400 Subject: [PATCH] fixed comprehension --- zipline/finance/risk.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zipline/finance/risk.py b/zipline/finance/risk.py index 338d14ae..a86a96f4 100644 --- a/zipline/finance/risk.py +++ b/zipline/finance/risk.py @@ -141,7 +141,13 @@ class RiskMetrics(): 'period_label' : period_label } - return {k:None if np.isnan(v) else v for k,v in rval.iteritems()} + def check_entry(key, value): + if key in {'algo_volatility', 'benchmark_volatility', 'beta'}: + return np.isnan(value) + else: + return False + + return {k:None if check_entry(k,v) else v for k,v in rval.iteritems()} def __repr__(self): statements = []