2019-06-17
阅读量:
528
如何使用numpy方法创建数组
使用numpy方法
创建数组: NumPy提供了几个函数来创建具有初始占位符内容的数组。这些最小化了增加阵列的必要性,这是一项昂贵的操作 例如:np.zeros,np.empty等。
numpy.empty(shape,dtype = float,order ='C'):返回给定形状和类型的新数组,带有随机值。
# Python Programming illustrating
# numpy.empty method
import
numpy as geek
b =
geek.empty(2, dtype =
int)
print("Matrix b : \n", b)
a =
geek.empty([2, 2], dtype =
int)
print("\nMatrix a : \n", a)
c =
geek.empty([3, 3])
print("\nMatrix c : \n", c)






评论(0)


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