Quantopian AttributeError: у объекта 'numpy.ndarray' нет атрибута 'DataFrame'. АЛГОРИТМ ПОЛЬЗОВАТЕЛЯ: 29 в вычислительной таблице = ty.DataFrame (index = assets) - PullRequest
0 голосов
/ 29 ноября 2018

Я пытаюсь внедрить значение общего дохода от Morningstar в мой алгоритм, но он выдает эту ошибку, что не так?

from quantopian.algorithm import attach_pipeline, pipeline_output
from quantopian.pipeline import Pipeline
from quantopian.pipeline import CustomFactor
from quantopian.pipeline.data.builtin import USEquityPricing
from quantopian.pipeline.data import morningstar

import pandas as pd
import numpy as np


class Totalyield(CustomFactor):   
    # Pre-declare inputs and window_length
    #total yield = dividend yield + buyback yield
    inputs = [morningstar.valuation_ratios.total_yield] 
    window_length = 1


    def compute(self, today, assets, out, ty):
        table = ty.DataFrame(index=assets)
        table ["ty"] = ty[-1]        
        out[:] = table.fillna(table.max()).mean(axis=1)

Я получаю ошибку времени выполнения

AttributeError: 'numpy.ndarray' object has no attribute 'DataFrame'
USER ALGORITHM:29, in compute
table = ty.DataFrame(index=assets)
...