Python使用shape计算矩阵的行和列
2015-09-29 20:48
441 查看
shape函数是numpy.core.fromnumeric中的函数,它的功能是读取矩阵的长度。
如上面的a矩阵,2行3列;计算行使用shape(a)[0];计算列使用shape(a)[1];
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];
相关文章推荐
- Python面向对象(二)
- Python计算出给定的时间段的具体日期列表-大全
- python coroutine的学习跟总结[转]
- python--tile函数
- python 给文件批量加‘“’ ”,"
- Python面向对象之继承
- Python面向对象(一)
- python string 使用正则表达式 split()
- Python DeprecationWarning 类型错误
- 在Python中使用protobuf2.6.1 string format utf-8 and unicode error
- 用python + hadoop streaming 编写分布式程序的本地调试方法
- python 发邮件乱码
- Python 列表的清空
- python 数学前自动补0的方法
- python笔记集合
- python线程join的正解
- Python 迭代删除重复项,集合删除重复项
- python笔记-调用eval函数出现invalid syntax错误
- python list和tuple相互转化
- 关于Python学习之我见 不断更新