Python numpy.asmatrix()

夜幕星河

Python numpy.asmatrix()

numpy.asmatrix(data, dtype =None)通过将输入解释为一个矩阵返回一个矩阵。
参数 :

data :类似数组的输入数据
dtype : 返回数组的数据类型

返回值 :

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]]

版权声明:本页面内容旨在传播知识,为用户自行发布,若有侵权等问题请及时与本网联系,我们将第一时间处理。E-mail:284563525@qq.com

目录[+]

取消
微信二维码
微信二维码
支付宝二维码