1 2 #numpy的使用 import numpy as np 1 2 data1 = [6,7.5,8,0,1] arr1 = np.array(data1) 1 2 data2 = [[1,2,3,4],[5,6,7,8]] arr2 = np.array(data2) 1 2 3 4 print(arr2.ndim) print(arr2.shape) print(arr1.dtype) print(arr2.dtype) 2 (2, 4) float64 int64 1 2 #数组初始化 np.zeros(10) array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]) 1 2 #多维数