
Tools
胡二妞
这个作者很懒,什么都没留下…
展开
-
将列表写入csv
import pandas as pdcolumns = ['PEID', '姓名', '检查日期']save_file = pd.DataFrame(columns=columns, data=data)save_file.to_csv('mm.csv', index=False, encoding="utf-8")其中data 形式对应于columns,是N*2的列表...原创 2018-06-05 14:59:38 · 5659 阅读 · 0 评论 -
PersonalRank推荐
详情见github: https://github.com/huawang123/tools/blob/master/PersonalRank0.py原创 2018-06-05 15:17:35 · 422 阅读 · 0 评论 -
基于RBM的推荐算法
详情见github:https://github.com/huawang123/tools/blob/master/RBM.py原创 2018-06-05 15:14:29 · 1137 阅读 · 0 评论 -
删除字符串最前边的几个数字
def del_left_num(s): for c in s: if c.isdigit(): s = s[1:] else: break return s原创 2018-06-05 15:08:41 · 1411 阅读 · 0 评论 -
利用url下载图片
详情见github:https://github.com/huawang123/tools/blob/master/down_img_from_url.py原创 2018-06-05 15:07:45 · 1489 阅读 · 0 评论 -
空洞填充
import numpy as npimport cv2def fillholse(im_th): ''' 空洞填充 param: im_th:二值图像 return: im_out:填充好的图像 ''' # Copy the thresholded image. im_flood...原创 2018-06-05 15:05:24 · 1648 阅读 · 0 评论 -
字符串中是否有汉字
def has_hz(contents): import re Pattern = re.compile(u'[\u4e00-\u9fa5]+') match = Pattern.search(contents) if match: return True else: return False原创 2018-06-05 15:03:01 · 1718 阅读 · 0 评论 -
保留有需求的字符
str1 = list(filter(lambda x: x.isdigit(), str0))#……function(.isdigit())可以变通查询字符串比如‘aaaa’.后边弹出的属性str1 = list(filter(lambda x: x not in '0123456789', str0))str = ''.join(str1)...原创 2018-06-05 15:02:10 · 151 阅读 · 0 评论 -
汉子转化为拼音
import pinyindef to_pinyin(var_str): """ 汉字[钓鱼岛是中国的]=>拼音[diaoyudaoshizhongguode]\n 汉字[我是shui]=>拼音[woshishui]\n 汉字[AreYou好]=>拼音[AreYouhao]\n 汉字[None]=>拼音[]\n 汉字[]=&g...原创 2018-06-05 15:00:51 · 743 阅读 · 0 评论 -
python找出一个列表中相同元素的多个索引
idx = [i for i,x in enumerate(X) if x==1]原创 2019-04-03 20:53:56 · 8331 阅读 · 3 评论