2020-07-20
阅读量:
928
常用数组
全0阵
np.zeros((3, 5), dtype=int) (形状,数据类型)
全1阵
np.ones((3, 3, 3), dtype="int32") (形状,数据类型)
单位阵
np.eye(3, dtype=int) (行列数,数据类型)
对角阵
np.diag([1, 5, 300, 444, 44, 666, 77]) 对角的数值
设置具体的值阵
np.full((3, 5),3.14 ) (形状,数值)
随机数阵
np.random.randint(1, 10, (3, 6)) (起始,终止,形状)
随机数阵
a = np.random.rand(2, 3) (行,列)
正态分布随机数阵
array = np.random.normal(4, 2, (10, 3)) (均值,标准差,形状)
线性序列阵
np.arange(0, 20, 4) (起始,终止,步长)
np.linspace(1, 101, 49, dtype=int) (起始,终止,产生数量)






评论(0)


暂无数据
推荐帖子
2条评论
0条评论
2条评论