numpy.asmatrix(data,dtype = None)通过将输入解释为矩阵来返回矩阵。
参数:
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 : \n", b, "\n")
c = geek.asmatrix(b)
b[0, 1] = 10
print("c matrix : \n", c)
输出:
Via array-like input : [[[5, 6, 7] [4, 6]]] c matrix : [[[5, 6, 7] 10]]
相关用法
注:本文由纯净天空筛选整理自 numpy.asmatrix() in Python。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。