当我对list用shape时出现’list’ object has no attribute ‘shape’
python中list, array的转换
上面的list_temp就是一个list类型,如果要进行numpy的一些数值运算,我们就需要将它转换为array类型。
转换如下:
import numpy as np
list_temp = [[1,2,3],[4,5,6]]
list_temp = np.array(list_temp)
print list_temp
当我对list用shape时出现’list’ object has no attribute ‘shape’
python中list, array的转换
上面的list_temp就是一个list类型,如果要进行numpy的一些数值运算,我们就需要将它转换为array类型。
转换如下:
import numpy as np
list_temp = [[1,2,3],[4,5,6]]
list_temp = np.array(list_temp)
print list_temp