努比。Python中的asmatrix()

努比。asmatrix(data,dtype=None)通过将输入解释为矩阵来返回矩阵。 参数:

null
data  : array-like input data 
dtype : Data type of returned array

返回:

Interprets the input as a matrix

# Python Programming illustrating
# numpy.asmatrix
import numpy as geek
# array-like input
b = geek.matrix([[ 5 , 6 , 7 ], [ 4 , 6 ]])
print ( "Via array-like input : " , b, "" )
c = geek.asmatrix(b)
b[ 0 , 1 ] = 10
print ( "c matrix : " , c)


输出:

Via array-like input : 
 [[[5, 6, 7] [4, 6]]] 

c matrix : 
 [[[5, 6, 7] 10]]

注: 这些NumPy Python程序不会在onlineID上运行,所以请在您的系统上运行它们来探索它们 . 本文由 莫希特·古普塔(Mohit Gupta_OMG) .如果你喜欢GeekSforgek,并想贡献自己的力量,你也可以使用 贡献极客。组织 或者把你的文章寄到contribute@geeksforgeeks.org.看到你的文章出现在Geeksforgeks主页上,并帮助其他极客。

如果您发现任何不正确的地方,或者您想分享有关上述主题的更多信息,请写下评论。

© 版权声明
THE END
喜欢就支持一下吧
点赞7 分享