Commit 5d06f98d authored by 桂秋月's avatar 桂秋月

新增ignore文件

parent 0f7d0c23
/search/tempFile
\ No newline at end of file
import time
from search import *
from search.abSearch import requestsend
......@@ -9,6 +11,10 @@ def fileData():
return df
def compareResult():
'''
commit=1,表示品牌,brandid;commit=9999,表示cid3,commit=2,表示跳过,默认不统计
:return:
'''
df=fileData()
temp_score=[]
for i in df.itertuples():
......@@ -23,26 +29,32 @@ def compareResult():
*info,cid3s,brandnames=\
requestsend(uuid,deviceid,query_context,selectedActivitie=1,page=1,env='pro')
if commit=='1' or commit==1:
score=[1 for i in temp_expect_cid3 if i in brandnames ]
tempbrandnames=brandnames[:5]
score=[1 for i in tempbrandnames if i in temp_expect_cid3 ]
temp_score.append(score)
df.loc[id,'score']=sum(score)
df.loc[id,'final_score']=round(sum(score)/len(tempbrandnames),2)
try:
df.loc[id,'actual_cid3']=','.join(brandnames)
df.loc[id,'actual_cid3']=','.join(brandnames[:5])
except:
#print(brandnames,type(brandnames))
brandnames=[str(i) for i in brandnames]
df.loc[id,'actual_cid3']=','.join(brandnames)
elif commit=='9999' or commit==9999:
score=[1 for i in temp_expect_cid3 if i in cid3s or str(i) in cid3s]
tempcid3s=cid3s[:5]
score=[1 for i in tempcid3s if i in temp_expect_cid3 ]
print('比对得分',score)
#print(score,id,type(id),df.loc(id))
#temp_score.append(score)
df.loc[id,'score']=sum(score)
df.loc[id,'actual_cid3']=','.join(cid3s)
df.loc[id,'final_score']=round(sum(score)/len(tempcid3s),2)
df.loc[id,'actual_cid3']=','.join(cid3s[:5])
#df.iloc[0,'score']=sum(score)
#i.__setattr__('score',sum(score))
else:
df.loc[id,'score']=0
df.loc[id,'final_score']=0
df.loc[id,'actual_cid3']=0
#df['score']=temp_score
......@@ -62,11 +74,10 @@ def anasfile(filename=None):
filename_path=os.path.join(file_path,filename.strip())
print('解析文件名:',filename_path)
df=readFile(filename_path)
temp_df=df[(df['commit']!=2) &(~ df['expect_cid3'].isna()) &(~ df['expect_cid3'].isna())]
temp_df['expect_cid3_len']=(temp_df['expect_cid3'].astype(str)+',').str.split(',')
#temp_df['expect_cid3_len']=(temp_df['expect_cid3'].astype(str)+',').str.split(',')
print('有效数据总数,',temp_df.shape[0])
temp_df['final_score']=temp_df['score']/(temp_df['expect_cid3_len'].apply(len)-1)
#temp_df['final_score']=temp_df['score']/(temp_df['expect_cid3_len'].apply(len)-1)
print("准确率",temp_df['final_score'].mean())
print('通过率',temp_df[temp_df['final_score']>0.6]['final_score'].mean())
print('无效数据总数',df[(df['commit']==2) | (df['commit']=='2')].shape[0])
......@@ -75,13 +86,14 @@ def anasfile(filename=None):
#print(temp_df['final_score'].head(2))
reportname=filePath(file_path,'final_result')
#df['skunos']=df['skunos'].astype('string')
temp_df.to_excel(reportname,index=0,encoding = 'utf-8')
# reportname=filePath(file_path,'final_result')
# #df['skunos']=df['skunos'].astype('string')
# temp_df.to_excel(reportname,index=0,encoding = 'utf-8')
if __name__ == '__main__':
#print(saveResult())
print(saveResult())
time.sleep(1)
print('1112',anasfile())
\ No newline at end of file
......@@ -33,6 +33,12 @@ def deleteFile(filename):
return 'delete succ'
return '{} is not found'.format(filename)
def getfirstFileData(file_path,filename=None):
filename=filename if filename \
else os.popen("cd {};ls -t |grep -v 'init' |head -1".format(file_path)).read(100)
filename_path=os.path.join(file_path,filename.strip())
print('解析文件名:',filename_path)
return filename_path
def readRenameColums(filename,fcolums,sheetname=0):
'''
......
......@@ -5,7 +5,7 @@ def genUuidDeviceid():
:return:
"""
uuid,deviced=codeuuid.uuid4().urn.split(':')[-1],codeuuid.uuid4().urn.split(':')[-1]
#uuid='c0c27ffb-f2da-4650-8855-2da2191ce772'
uuid='94d0e54c-9564-44bd-8c7e-abd8308081af'
deviced='guiqiuyue_'+str(deviced)
return uuid,deviced
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment