python矩阵

B=min(A):获得矩阵A每一列的最小值,返回值B为一个行向量,其第i列对应A矩阵第i列的最小值。
C=max(A) :获得矩阵A每一列的最大值,返回值C为一个行向量,其第i列对应A矩阵第i列的最大值。

import numpy as np
a = np.array([[1,5,3],[4,2,6]])
print(a.min()) #无参,所有中的最小值
print(a.min(0)) # axis=0; 每列的最小值
print(a.min(1)) # axis=1;每行的最小值
# 1
# [1 2 3]
# [1 2]
欢迎关注我的公众号:小秋的博客 CSDN博客:https://blog.csdn.net/xiaoqiu_cr github:https://github.com/crr121 联系邮箱:rongchen633@gmail.com 有什么问题可以给我留言噢~
原文地址:https://www.cnblogs.com/flyingcr/p/10327080.html