'list' object has no attribute 'shape'

后端 未结 7 774
执笔经年
执笔经年 2020-12-07 22:13

how to create an array to numpy array?

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



if __name__==\"__main__\":

    X =         


        
7条回答
  •  一向
    一向 (楼主)
    2020-12-07 22:46

    if the type is list, use len(list) and len(list[0]) to get the row and column.

    l = [[1,2,3,4], [0,1,3,4]]
    

    len(l) will be 2 len(l[0]) will be 4

提交回复
热议问题