NumPy笔记:创建ndarray数组(array,asarray,copy)
import numpy as np a = np.array([[1, 1, 1, 2, 2, 2]]) a1 = np.array(a) a2 = np.asarray(a) a3 = np.copy(a) print("a1:", a1) print("a2:", a2) print("a3:", a3)
a1: [[1 1 1 2 2 2]] a2: [[1 1 1 2 2 2]] a3: [[1 1 1 2 2 2]]