I'm working in research and trying to create a True/False factor as something like the following:
financial_health_grade = morningstar.asset_classification.financial_health_grade.latest
if financial_health_grade == 'D':
health_fail_bool = True
else:
health_fail_bool = False
However, when executing the make_pipeline() call, I get the following error. Any idea what I am doing wrong?
AttributeErrorTraceback (most recent call last)
<ipython-input-543-dcf250cf5490> in <module>()
----> 1 my_pipe = make_pipeline()
<ipython-input-542-faa743d32976> in make_pipeline()
98 'health_fail_bool': health_fail_bool
99 },
--> 100 screen=securities_to_trade
101 )
102
/build/src/qexec_repo/zipline_repo/zipline/pipeline/pipeline.py in __init__(self, columns, screen)
40 screen=optional(Filter),
41 )
---> 42 def __init__(self, columns=None, screen=None):
43 if columns is None:
44 columns = {}
/build/src/qexec_repo/zipline_repo/zipline/pipeline/pipeline.pyc in __init__(self, columns, screen)
46 validate_column = self.validate_column
47 for column_name, term in columns.items():
---> 48 validate_column(column_name, term)
49 if not isinstance(term, ComputableTerm):
50 raise TypeError(
/build/src/qexec_repo/zipline_repo/zipline/pipeline/pipeline.pyc in validate_column(column_name, term)
231 @staticmethod
232 def validate_column(column_name, term):
--> 233 if term.ndim == 1:
234 raise UnsupportedPipelineOutput(column_name=column_name, term=term)
AttributeError: 'bool' object has no attribute 'ndim'
Edit: Figured this out right after I posted (isn't that how it always is!). For those coming up with the same problem, the solution is as follows:
health_fail_bool = financial_health_grade.element_of(['D'])