shape函数是numpy.core.fromnumeric中的函数,它的功能是读取矩阵的长度。

1 >>> a=mat([[1,2,3],[5,6,9]]);
2 >>> a
3 matrix([[1, 2, 3],
4         [5, 6, 9]])
5 >>> shape(a)[0]
6 2
7 >>> shape(a)[1]
8 3

如上面的a矩阵,2行3列;计算行使用shape(a)[0];计算列使用shape(a)[1];

 

posted on 2015-09-29 20:48  chamie  阅读(2375)  评论(0编辑  收藏  举报