首页 > 编程语言 > 详细

Python numpy shape 矩阵

时间:2020-01-15 17:44:55      阅读:74      评论:0      收藏:0      [点我收藏+]

原文:https://blog.csdn.net/u014159143/article/details/80318433

 

 

import numpy as np


x = np.array([[1,2,5],[2,3,5],[3,4,5],[2,3,6]])

# 输出数组的行和列数
print(x.shape)  #结果: (4, 3)

# 只输出行数
print(x.shape[0]) #结果: 4

# 只输出列数
print(x.shape[1]) #结果: 3


# h:行树 w:列数
h, w = x.shape[:2]
print(h)
print(w)

Python numpy shape 矩阵

原文:https://www.cnblogs.com/guxingy/p/12197739.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!