Transform from list in python to mat in numpy
来源:互联网 发布:linux c项目开发ide 编辑:程序博客网 时间:2024/05/29 16:19
Code_1
import numpy as np dataMat = [] dataMat.append([1,2,3],[4,5,6]) mat = np.mat(dataMat) print np.shape(mat)
(2,3)
Code_2
import numpy as np labelMat = [] labelMat.append(1) labelMat.append(2) labelMat.append(3) mat = np.mat(labelMat) print np.shape(mat)
(1,3)
Code_3
import numpy as np labelMat = [] labelMat.append([1]) labelMat.append([2]) labelMat.append([3]) mat = np.mat(labelMat) print np.shape(mat)
(3,1)
Notice the difference between Code_2 and Code_3. It is pretty important if we need to do some matrix computation.
0 0
- Transform from list in python to mat in numpy
- Numpy.mat in Python
- How to Display Image In Picturebox in VC++ from Iplimage and Mat
- list in python
- "list" in python
- flatten list in python
- List object in Python
- numpy中mat和python的list转换
- numpy中mat和python的list转换
- How to Get a List of Class Attributes in Python
- How to pass List from Controller to View in MVC 3.
- python的奇怪小地方 in numpy
- Convert mat to numpy array , numpy gradient
- distinguish "list" & "array" in python
- What to expect from Microsoft in 2007
- Introduction to SQLite in Python
- how to get the return value from a thread in python?
- To do list in my lifetime
- Ubuntu下Sublime Text 3的安装及一些配置
- Android Google Map学习二(接受位置更新信息)
- sscanf()从一个字符串中读进与指定格式相符的数据
- Leangoo如何颠覆传统项目管理软件?
- Android开发中使用AndroidStudio与Eclipse的代码区别
- Transform from list in python to mat in numpy
- SparkR数据分析
- android 窗体透明、黑暗度、背景模糊
- iOS 查看真机中的沙盒内容(步骤)
- coursera Machine learning Andrew NG 学习笔记(二)—Logistic regression
- 快速获取json字段内的数据(减去填写字段的步骤)
- Android Studio 很卡怎么解决
- 交换机割接
- NULL的用法