numpy.shape

tech2024-12-06  5

a = np.array([[1, 2, 3], [2, 3, 2]]) print(a.shape)

out:

(2, 3)


a = np.array([[1, 2, 3]]) print(a.shape)

out:

(1, 3) #1行3列,a.shape[0] = 1


a = np.array([1, 2, 3]) print(a.shape)

out: (3,)

这里是引用


以上三种类型均为<class ‘numpy.ndarray’>

最新回复(0)