📜  numpy.matrix.A()函数– Python

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

numpy.matrix.A()函数– Python

numpy.matrix.A()函数将 self 作为 ndarray 对象返回。

代码#1:

# Python program explaining
# numpy.matrix.A() function
          
# importing numpy as geek 
import numpy as geek 
      
mat = geek.matrix(geek.arange(9).reshape((3, 3)))
    
gfg = mat.getA()
    
print (gfg)

输出 :

[[0 1 2]
 [3 4 5]
 [6 7 8]]


代码#2:

# Python program explaining
# numpy.matrix.A() function
          
# importing numpy as geek 
import numpy as geek 
      
mat = geek.matrix(geek.arange(20).reshape((4, 5)))
    
gfg = mat.getA()
    
print (gfg)

输出 :

[[ 0  1  2  3  4]
 [ 5  6  7  8  9]
 [10 11 12 13 14]
 [15 16 17 18 19]]