python
懵圈丰
这个作者很懒,什么都没留下…
展开
-
python读文件
python的读取文件,主要是语法原创 2015-04-02 00:12:54 · 674 阅读 · 0 评论 -
删除没有购物行为的人
#!/usr/bin/env pythonrd = open('whoBuyWhat.csv')data3 = open('data_16_16_3.csv')wr3 = open('delNoBuyed4.5.1.csv','w+')rdt = rd.readlines()rdt_id = []for key in rdt: te = key.split(',')原创 2015-04-05 11:07:25 · 554 阅读 · 0 评论 -
求两个文件交集
#!/usr/bin/env pythonrd3 = open('data_17_17_2.csv')base = open('data_17_17_3.csv')wr3 = open('delNoBuyed3DayAndStoreAndInCar4.5.2.csv','w+')bsData = base.readlines()i = 1for key in rd3:原创 2015-04-05 11:07:55 · 815 阅读 · 0 评论 -
按时间提取数据,某比赛
#!/usr/bin/env pythonfrom datetime import datetimefl = open('tianchi_mobile_recommend_train_user.csv')ns = open('data_16_16_3.csv','w+')#na = open('data_17_17_2.csv','w+')nsf = []naf = []原创 2015-04-05 11:06:04 · 491 阅读 · 0 评论 -
验证集 某比赛
#!/usr/bin/env pythonfl = open('delNoBuyed4.5.1.csv')na = open('valia_17.csv')fl.readline()submit = fl.readlines()na17 = na.readlines()sub_num = len(submit)na_num = len(na17)ri = 0fo原创 2015-04-05 11:06:42 · 558 阅读 · 0 评论 -
点击天数分析
data1元数据219precision:0.0401098901099recall:0.0566330488751f1:0.0469604374397大于25天点击168precision:0.0431654676259recall:0.0434445306439f1:0.0433045495554大于20天点击207preci原创 2015-04-10 21:07:38 · 485 阅读 · 0 评论 -
天池,改为开发包所需的文件输入
#!/usr/bin/env pythonfl = open('not.csv')wr = open('changeTpye.csv','w+')for key in fl: pt = key.split(',') wr.write(pt[0]+'::'+pt[1]+'::'+pt[2]+'::'+pt[4]) print ptfl.close()wr.clo原创 2015-04-02 22:07:06 · 740 阅读 · 0 评论 -
天池,删除时间
#!/usr/bin/env pythonimport numpy as npfrom datetime import datetime#fl = open('te.csv')#item_id,item_geohash,item_categoryfl = open('tianchi_mobile_recommend_train_user.csv')#user_id,item原创 2015-04-02 22:05:16 · 700 阅读 · 0 评论 -
天池,删除地址
#!/usr/bin/env pythonfl = open('train.csv')wrr = open('no_time_but_add.csv','w+')for key in fl: pt = key.split(',') if pt[2] != '': wrr.write(key) print ptfl.close()wr.close(原创 2015-04-02 22:06:12 · 652 阅读 · 0 评论 -
python读取并切分
#!/usr/bin/env pythonimport numpy as npfl = open('te.csv')try: text = fl.readline( )finally: print text #fl.close( )#print text#data = np.loadtxt("\usr\data\tianchi_mobile_recomm原创 2015-04-02 01:06:47 · 2642 阅读 · 0 评论 -
召回率,准确率,f1分析 某大赛1
前4天,通过购物车购买precision:0.0153313777615recall:0.177594903106f1:0.0282260616417前4天,通过收藏夹购买precision:0.00326368668608recall:0.0270772498009f1:0.00582524271845前4天 , 通过购物车&收藏夹购买precision:原创 2015-04-05 10:08:18 · 1061 阅读 · 0 评论