python
健雄
擅长spark、数据挖掘、人脸识别、opencv
精通c/c++,scala语言,python
展开
-
pandas怎样对数据进行遍历
pandas.DataFrame.iterrowsDataFrame.iterrows() 迭代(iterate)覆盖整个DataFrame的行中,返回(index, Series)对。import numpy as npimport pandas as pddef _map(data, exp): for index, row in data.ite原创 2016-01-29 10:47:43 · 88191 阅读 · 0 评论 -
python之文件编码转换
原文件temp.txt内容: with open('C:\\Users\\Administrator\\Desktop\\temp.txt', 'r') as file_in: with open('C:\\Users\\Administrator\\Desktop\\temp1.txt', 'w') as file_out: file_out.write(file_in.原创 2016-02-23 14:50:33 · 408 阅读 · 0 评论 -
python读文件
读文件操作:from collections import Counterwith open("./data.txt", 'r') as f: domain_counts = Counter(line.strip().lower().split("@")[-1] for line in f原创 2016-03-11 10:01:38 · 320 阅读 · 0 评论 -
python之sorted、map、reduce、join、split函数的实例操作
sorted数据如下: key为选择需要排序的元素;reverse为True,表示逆序排序。 reverse为False,表示顺序排序。 map数据如下。 按lambda表达式操作。 reduce按lambda表达式操作,数据如上。 join数据如下。 使用’+’把元素连接起来。 split数据如上,把字符串按’ ‘分隔符分开。原创 2016-03-11 11:21:24 · 1134 阅读 · 0 评论