
python
tf2333
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 11: ordinal not in range(128)
在用python画决策树时,运行显示UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 11: ordinal not in range(128)这个错误,应该是ascii和unicode编码冲突导致,解决方法是添加下面3行代码: import sys reload(sys) sys.setdefaultenc原创 2016-04-17 16:56:28 · 856 阅读 · 0 评论 -
python函数(一)
最近学习机器算法,刚接触python不久,碰到许多函数,经动手实践,了解了他们的用法 1.tolist()函数:将数组,阵列返回为list a=mat([[1,2,3],[2,3,4],[3,4,5]]) a Out[12]: matrix([[1, 2, 3], [2, 3, 4], [3, 4, 5]]) a.tolist() Out[17]: [[1,原创 2016-04-24 13:22:13 · 439 阅读 · 0 评论 -
python函数(二)
机器学习算法中遇到许多python函数,记录它们的用法以加深印象。 1.tile函数:如tile(A,n)是将数组A重复n次,构成一个新数组 a=[0,1,2] b=tile(a,2) b Out[83]: array([0, 1, 2, 0, 1, 2]) b=tile(a,(2,1)) b Out[85]: array([[0, 1, 2], [0, 1, 2]])原创 2016-04-24 17:39:17 · 310 阅读 · 0 评论