相关疑难解决方法(0)

'list'对象没有属性'shape'

如何创建一个数组到numpy数组?

def test(X, N):
    [n,T] = X.shape
    print "n : ", n
    print "T : ", T



if __name__=="__main__":

    X = [[[-9.035250067710876], [7.453250169754028], [33.34074878692627]], [[-6.63700008392334], [5.132999956607819], [31.66075038909912]], [[-5.1272499561309814], [8.251499891281128], [30.925999641418457]]]
    N = 200
    test(X, N)
Run Code Online (Sandbox Code Playgroud)

我收到错误了

AttributeError: 'list' object has no attribute 'shape'
Run Code Online (Sandbox Code Playgroud)

那么,我想我需要将我的X转换为numpy数组?

python numpy list

47
推荐指数
6
解决办法
23万
查看次数

标签 统计

list ×1

numpy ×1

python ×1