Commit 426684e7 authored by 高雅喆's avatar 高雅喆

fix bug

parent 7e9d63c9
...@@ -93,6 +93,7 @@ class TopFeatures(object): ...@@ -93,6 +93,7 @@ class TopFeatures(object):
rtype : none rtype : none
""" """
with open(fpath, 'w') as f: with open(fpath, 'w') as f:
tplt = "{0:\u3000<4}\t{1:\u3000<12}\t{2:\u3000^6}\t{3:\u3000^6}\t{4:\u3000<8}\t{5:\u3000^15}\n" tplt = "{0:\u3000<4}\t{1:\u3000<12}\t{2:\u3000^6}\t{3:\u3000^6}\t{4:\u3000<8}\t{5:\u3000^15}\n"
f.write("Top {0} {1}\n".format(self.top_n,self.cid_type)) f.write("Top {0} {1}\n".format(self.top_n,self.cid_type))
sep = "=================================================================\n" sep = "=================================================================\n"
...@@ -111,21 +112,23 @@ class TopFeatures(object): ...@@ -111,21 +112,23 @@ class TopFeatures(object):
def main(): def main():
top_diary = TopFeatures(1, "all", "diary", 100) top_answer_all = TopFeatures(1, "all", "answer", 100)
clk_diary_times_all = top_diary.get_click_times() clk_answer_times_all = top_answer.get_click_times()
imp_diary_times_all = top_diary.get_impression_times() imp_answer_times_all = top_answer.get_impression_times()
clk_diary_ctr_all = top_diary.get_result(clk_diary_times_all, imp_diary_times_all, 4, "ctr") clk_answer_ctr_all = top_answer.get_result(clk_answer_times_all, imp_answer_times_all, 4, "ctr")
clk_diary_times_ios = top_diary.get_click_times() top_answer_all = TopFeatures(1, "ios", "answer", 100)
imp_diary_times_ios = top_diary.get_impression_times() clk_answer_times_ios = top_answer.get_click_times()
clk_diary_ctr_ios = top_diary.get_result(clk_diary_times_ios, imp_diary_times_ios, 4, "ctr") imp_answer_times_ios = top_answer.get_impression_times()
clk_answer_ctr_ios = top_answer.get_result(clk_answer_times_ios, imp_answer_times_ios, 4, "ctr")
clk_diary_times_android = top_diary.get_click_times() top_answer_all = TopFeatures(1, "android", "answer", 100)
imp_diary_times_android = top_diary.get_impression_times() clk_answer_times_android = top_answer.get_click_times()
clk_diary_ctr_android = top_diary.get_result(clk_diary_times_android, imp_diary_times_android, 4, "ctr") imp_answer_times_android = top_answer.get_impression_times()
clk_answer_ctr_android = top_answer.get_result(clk_answer_times_android, imp_answer_times_android, 4, "ctr")
result_lst = [clk_diary_ctr_all, clk_diary_ctr_ios, clk_diary_ctr_android] result_lst = [clk_diary_ctr_all, clk_diary_ctr_ios, clk_diary_ctr_android]
output_path = DIRECTORY_PATH + "5top100_ctr_diary_%s.txt".format(get_yesterday_date()) output_path = DIRECTORY_PATH + "top100_ctr_diary_%s.txt".format(get_yesterday_date())
top_diary.result2file(result_lst, output_path) top_diary.result2file(result_lst, output_path)
......
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