numpy.matrix.A()函数– Python
numpy.matrix.A()
函数将 self 作为 ndarray 对象返回。
Syntax : numpy.matrix.A()
Parameters : None
Return : [ndarray] Return self as an 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]]