import numpy as np # 创建一个Ndarray # 1. 从list对象中创建 # 2. 创建一个特定的数组,全1数组ones,随机数组random.randn,对角矩阵diag # 数组的属性:ndim,shape,size,dtype # 数组的索引 # 1. 索引index # 2. 切片slicing lst = [1,2,3] a = np.array(lst) type(a)
import numpy as np # 创建一个Ndarray # 1. 从list对象中创建 # 2. 创建一个特定的数组,全1数组ones,随机数组random.randn,对角矩阵diag # 数组的属性:ndim,shape,size,dtype # 数组的索引 # 1. 索引index # 2. 切片slicing lst = [1,2,3] a = np.array(lst) type(a) np.ones((2,3)) np.random.randn(2,3,2)