python
xiaozi-ML
这个作者很懒,什么都没留下…
展开
-
解决UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe5 in position 108: ordinal not in range(12
文件夹地址中有中文字符,出现这样的错误,网上在另一个博客中找到这个解决方案,可用。今天做网页到了测试和数据库交互的地方,其中HTML和数据库都是设置成utf-8格式编码,插入到数据库中是正确的,但是当读取出来的时候就会出错,原因就是python的str默认是ascii编码,和unicode编码冲突,就会报这个标题错误。那么该怎样解决呢?通过搜集网上的资料,自己多次尝试,转载 2015-04-28 16:06:14 · 848 阅读 · 0 评论 -
numpy unique()
unique()保留数组中不同的值,返回两个参数。>>> a=np.random.randint(0,5,8) >>> a array([2, 3, 3, 0, 1, 4, 2, 4]) >>> np.unique(a) array([0, 1, 2, 3, 4]) >>> c,s=np.unique(b,return_index=True) >原创 2015-05-05 11:03:57 · 19672 阅读 · 0 评论 -
Python IOError: File not open for writing
p = open('python1.csv','wb')注意后面‘wb’,没有这个关键字就会提示错误!!!原创 2015-05-06 13:43:31 · 9598 阅读 · 0 评论 -
8.aggregate()
描述:计算数据子集的汇总统计量aggregate(x, ...)## Default S3 method:aggregate(x, ...)## S3 method for class 'data.frame'aggregate(x, by, FUN, ..., simplify = TRUE)## S3 method for class 'formula'aggregate(...转载 2018-09-18 09:08:23 · 630 阅读 · 0 评论