matrix.A

if __name__ == '__main__':
    from numpy import *
    a = mat([[0, 0, 0, 2, 2],
             [0, 0, 0, 3, 3],
             [0, 0, 0, 1, 1],
             [1, 1, 1, 0, 0],
             [2, 2, 2, 0, 0],
             [5, 5, 5, 0, 0],
             [1, 1, 1, 0, 0]])
    print(a[:,3])
    print(type(a[:,3]))
    print(a[:,3].A)
    print(type(a[:,3].A))
'''
[[2]
 [3]
 [1]
 [0]
 [0]
 [0]
 [0]]
<class 'numpy.matrixlib.defmatrix.matrix'>
[[2]
 [3]
 [1]
 [0]
 [0]
 [0]
 [0]]
<class 'numpy.ndarray'>#数组类型
'''


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