多种 numpy 的属性
这次我们会介绍几种 numpy 的属性:
ndim:维度
shape:行数和列数
size:元素个数
使用numpy首先要导入模块
array = np.array([[1,2,3],[2,3,4]]) #列表转化为矩阵
print(array)
“”"
array([[1, 2, 3],
[2, 3, 4]])
“”"
print(‘number of dim:’,array.ndim) # 维度
#number of dim:2
print(‘shape :’,array.shape) # 行
原创
2021-10-15 10:51:16 ·
198 阅读 ·
0 评论