矩阵转列表

矩阵转列表

>>> testMat
matrix([[ 1.,  0.,  0.,  0.],
        [ 0.,  1.,  0.,  0.],
        [ 0.,  0.,  1.,  0.],
        [ 0.,  0.,  0.,  1.]])
>>> testMat[:,-1]
matrix([[ 0.],
        [ 0.],
        [ 0.],
        [ 1.]])
>>> testMat[:,-1].T
matrix([[ 0.,  0.,  0.,  1.]])
>>> testMat[:,-1].T.tolist()
[[0.0, 0.0, 0.0, 1.0]]
>>> testMat[:,-1].T.tolist()[0]
[0.0, 0.0, 0.0, 1.0]
>>>

dataSet[:,-1].T.tolist()[0])


欢迎关注我的公众号:小秋的博客 CSDN博客:https://blog.csdn.net/xiaoqiu_cr github:https://github.com/crr121 联系邮箱:rongchen633@gmail.com 有什么问题可以给我留言噢~
原文地址:https://www.cnblogs.com/flyingcr/p/10327026.html