为什么下面的代码生成一个numpy数组,并在list3的数组内打印列表?
enter image description here 观察到的输出:
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))