Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/352.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python包bt:Bool索引错误_Python_Pandas_Boolean - Fatal编程技术网

Python包bt:Bool索引错误

Python包bt:Bool索引错误,python,pandas,boolean,Python,Pandas,Boolean,这就产生了错误: AttributeError:'numpy.bool_3;'对象没有属性'index' 看起来它与以下行有关: class SelectWhere(bt.Algo): def __init__(self, signal): self.signal = signal def __call__(self, target): # get signal on target.now if target.now in self.signal.index:

这就产生了错误:

AttributeError:'numpy.bool_3;'对象没有属性'index'

看起来它与以下行有关:

class SelectWhere(bt.Algo):
def __init__(self, signal):
    self.signal = signal

def __call__(self, target):
    # get signal on target.now
    if target.now in self.signal.index:
        sig = self.signal.loc[target.now]

        # get indices where true as list
        selected = list(sig.index[sig])

        # save in temp - this will be used by the weighing algo
        target.temp['selected'] = selected

    # return True because we want to keep on moving down the stack
    return True
现在我只是想知道这意味着什么,因为创建这个列表的全部目的是根据策略的规则在数据集中迭代一个真/假指示符-但是这样的数据类型不能有索引

            selected = list(sig.index[sig])