Lists to numpy array

谁都会走 提交于 2019-12-11 04:55:14

问题


Why does the following code generate a numpy array with lists printed inside the array for list3?

enter image description here Output observed:

list2=[[1,2,3],[4,5,6],[7,8,9]] #list of 3 lists makes 3 rows and 3 
columns for numpy array
#each list fills one row
print('List2',list2)
print('List2 casted as 3x3 array',np.array(list2))

list3=[[1,2,3],[4,5,6],[7,8]]
print(np.array(list3))

来源:https://stackoverflow.com/questions/56455371/lists-to-numpy-array

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!