TypeError: unsupported operand type(s) for *: 'float' and 'ABCMeta' ...
Hello all,
I'm having a bit of trouble with an algo I've been working on. I would like to do a 'fact check' if you will and see if a stock is a good vale for its expected growth. To do so, I'd like to check its forward earning's yield (the float in the error) against that of the industry (the ABCMeta). However, when I try to run the backtest with a later filter I am informed I'm trying to multiply a float by and ABCMeta. I'm not familiar with ABCMeta, nor am I familiar with what it does, or how its been output from my code for that matter, but attached below is where it is born.
Any thoughts on how I can right this wrong? I'm just trying to get the below code to produce a number for each individual stock.
Thanks a ton in advance!
class Ind_forward_e_yield(CustomFactor):
window_length = 1
inputs = [morningstar.valuation_ratios.forward_earning_yield,
morningstar.asset_classification.morningstar_industry_code]
def compute(self, today, assets, out, forward_earning_yield, industries):
df = pd.DataFrame(index=assets, data={
"forward_e_yield": forward_earning_yield[-1],
"industry_codes": industries[-1]
})
df.reset_index(inplace=True)
adf = df[df['industry_codes'] != -1].groupby(['industry_codes'])['forward_e_yield'].mean()
adf = adf.to_frame('industry_forward_e_yield')
adf.reset_index(inplace=True)
df = df.merge(adf, how='outer', on='industry_codes')
df = df.set_index('index')
df.fillna(df.min()).mean(axis=1)
df.sort_index(inplace=True)
out[:] = df['industry_forward_e_yield'].values