np.zeros错误的索引太多了

时间:2018-05-15 15:56:38

标签: python-3.x

我需要理解错误我已经分别查看了R和df1的所有形状(2265,2),(4616,6),如错误回溯中描述的那样,错误来自于循环中的测试用例,其中不明白。我重新开始根据R从2265

计算行动的价值
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-2-62513555e96b> in <module>()
    140     print(R.shape)
    141 
--> 142 main()
    143 
    144 

<ipython-input-2-62513555e96b> in main()
    131     #test
    132     for i in range (2265,4615,1):
--> 133         if(R[i-1,0]>R[i-1,1]):
    134             action[i]=1
    135         else:

IndexError: too many indices for array

在下面的第一部分中一切正常:

#test
    for i in range (2265,4615,1):
        if(R[i-1,0]>R[i-1,1]):
            action[i]=1
        else:
            action[i]=0
        N = number_update(action,2265,4615)
        RHO = Rhoo(action,2265,4615)
        R = reward_max(action,2265,4615)
    print(R.shape)

main()

0 个答案:

没有答案