📜  Python| numpy matrix.getA()

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

Python| numpy matrix.getA()

Numpy matrix.getA()方法的帮助下,我们可以获得与给定矩阵相同大小的ndarray

示例 #1:
在这个例子中,我们可以看到我们能够在方法matrix.getA()的帮助下获得 numpy 数组。

# import the important module in python
import numpy as np
          
# make matrix with numpy
gfg = np.matrix('[6; 2; 3]')
          
# applying matrix.getA() method
geeks = gfg.getA()
    
print(geeks)
输出:
[[6]
 [2]
 [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.getA() method
geeks = gfg.getA()
    
print(geeks)
输出:
[[1 2 3]
 [4 5 6]
 [7 8 9]]