import numpy as np
1.np.array():将输入数据(列表、元组、数组或其他序列类型)转换为ndarray,要么推断出dtype,要么显式指定dtype。默认直接复制输入数据。 array.shape属性表示行*列,一维数组或者说向量,即列向量表示
>>> a = np.array([[1.0, 2.0], [3.0, 4.0]])
>>> print(a)
[[1. 2.]
[3. 4.]]
>>> print(a.shape)
(2, 2)
>>> c = np.array([[1,2,3,4],[3,4,5,0],[6,6,6,6]])
>>> print(c)
[[1 2 3 4]
[3 4 5 0]
[6 6 6 6]]
>>> print(a.shape)
(2, 2)
>>> print(c.shape)
(3, 4)
>>> a = np.array([0, 1, 2, 3, 4])
>>> print(a)
[0 1 2 3 4]
>>> print(a.shape)
(5,)