[英]Element of 2D matrix in Python
I have the following Python code to display the matrix element, but it does not show what is expected as I want to show the first element instead of first line elements. 我有以下Python代码来显示matrix元素,但是由于我想显示第一个元素而不是第一行元素,所以它没有显示预期的结果。 What is the problem?
问题是什么?
import numpy as np
ss = [-0.115, -0.052, 0.559, -0.344, 0.077, 0.032, -0.017, -0.035]
sx = np.matrix([[ss[0],ss[1],ss[2],ss[3]],[ss[4],ss[5],ss[6],ss[7]]])
print('s0=', sx[0])
print('s00=', sx[0][0])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.