📜  Python| numpy matrix.getT()

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

Python| numpy matrix.getT()

借助Numpy matrix.getT()方法,我们可以获得与给定矩阵相同大小的转置

示例 #1:
在这个例子中,我们可以看到我们能够在方法matrix.getT()的帮助下获得转置

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

示例 #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.getT() method
geeks = gfg.getT()
    
print(geeks)
输出:
[[1 4 7]
 [2 5 8]
 [3 6 9]]