Commit e6b225e9 authored by 张彦钊's avatar 张彦钊

修改统计指标

parent 11cfd3fd
...@@ -43,20 +43,20 @@ def ctr_all(): ...@@ -43,20 +43,20 @@ def ctr_all():
cover_percent = format(cover / len(tail56), ".6f") cover_percent = format(cover / len(tail56), ".6f")
print("当天尾号5或6活跃用户覆盖率:") print("当天尾号5或6活跃用户覆盖率:")
print(cover_percent) print(cover_percent)
sql_click = "select count(cid) from data_feed_click " \ # sql_click = "select count(cid) from data_feed_click " \
"where (cid_type = 'diary' or cid_type = 'diary_video') " \ # "where (cid_type = 'diary' or cid_type = 'diary_video') " \
"and stat_date = '{}' and device_id regexp '[5|6]$';".format(date) # "and stat_date = '{}' and device_id regexp '[5|6]$';".format(date)
cursor.execute(sql_click) # cursor.execute(sql_click)
click = cursor.fetchone()[0] # click = cursor.fetchone()[0]
print("点击数:" + str(click)) # print("点击数:" + str(click))
sql_exp = "select count(cid) from data_feed_exposure " \ # sql_exp = "select count(cid) from data_feed_exposure " \
"where (cid_type = 'diary' or cid_type = 'diary_video') and stat_date = '{}' and " \ # "where (cid_type = 'diary' or cid_type = 'diary_video') and stat_date = '{}' and " \
"device_id regexp '[5|6]$'".format(date) # "device_id regexp '[5|6]$'".format(date)
cursor.execute(sql_exp) # cursor.execute(sql_exp)
exp = cursor.fetchone()[0] # exp = cursor.fetchone()[0]
print("曝光数:" + str(exp)) # print("曝光数:" + str(exp))
print("点击率:" + str(click / exp)) # print("点击率:" + str(click / exp))
return len(tail56),cover,cover_percent,click,exp,format(click/exp,".6f") return len(tail56),cover,cover_percent
def ctr(): def ctr():
...@@ -83,8 +83,7 @@ def rate2file(): ...@@ -83,8 +83,7 @@ def rate2file():
output_path = DIRECTORY_PATH + "56ctr.csv" output_path = DIRECTORY_PATH + "56ctr.csv"
with open(output_path,'a+') as f: with open(output_path,'a+') as f:
line = date.replace('-', '')+','+str(temp_data[0])+','+str(temp_data[1])+','+str(temp_data[2])+\ line = date.replace('-', '')+','+str(temp_data[0])+','+str(temp_data[1])+','+str(temp_data[2])+\
","+str(data[0])+","+str(data[1])+","+str(data[2])+","+str(data[3])+","+str(data[4])\ ","+str(data[0])+","+str(data[1])+","+str(data[2])+'\n'
+","+str(data[5])+'\n'
f.write(line) f.write(line)
......
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