📜  Python| numpy matrix.max()

📅  最后修改于: 2022-05-13 01:54:20.177000             🧑  作者: Mango

Python| numpy matrix.max()

借助Numpy matrix.max()方法,我们可以从给定矩阵中获取最大值

示例 #1:
在这个例子中,我们可以看到我们能够在方法matrix.max()的帮助下从给定矩阵中获得最大值。

# import the important module in python
import numpy as np
          
# make matrix with numpy
gfg = np.matrix('[64, 1; 12, 3]')
          
# applying matrix.max() method
geeks = gfg.max()
    
print(geeks)
输出:
64

示例 #2:

# import the important module in python
import numpy as np
          
# make a matrix with numpy
gfg = np.matrix('[1, 2, 3; 4, 5, 6; 7, 8, 9]')
          
# applying matrix.max() method
geeks = gfg.max()
    
print(geeks)
输出:
9