Commit 5b39ddf3 authored by 张彦钊's avatar 张彦钊

add print

parent 3242889e
......@@ -120,7 +120,9 @@ def save_result(queue_name, x_list):
score_df = pd.read_csv(DIRECTORY_PATH + "result/output{0}_{1}.csv".format(device_id,queue_name), header=None)
score_df = score_df.rename(columns={0: "score"})
score_df["cid"] = x_list
print("done save_reult")
score_df = score_df.sort_values(by="score", ascending=False)
print("概率前十行:")
print(score_df.head(10))
return score_df
......@@ -136,21 +138,9 @@ def merge_score(x_list, score_df):
sql = "select score from biz_feed_diary_score where diary_id in {};".format(x_list)
cursor.execute(sql)
result = cursor.fetchall()
print("获取成功")
score_list = pd.DataFrame(list(result))[0].values.tolist()
#score_list = []
# for i in x_list:
# sql = "select score from biz_feed_diary_score where diary_id = '{}';".format(i)
# cursor.execute(sql)
# if cursor.execute(sql) != 0:
# result = cursor.fetchone()[0]
# score_list.append(result)
# print("成功获取")
# # 没有查到这个diary_id,默认score值是0
# else:
# print("结果是空")
# score_list.append(0)
score_df = pd.DataFrame(list(result))
print("数据库日记表前十行")
score_list = score_df[0].values.tolist()
db.close()
......
......@@ -103,6 +103,7 @@ def save_result(queue_name, x_list):
score_df = pd.read_csv("/Users/mac/utils/result/{0}_output.txt".format(queue_name), header=None)
score_df = score_df.rename(columns={0: "score"})
score_df["cid"] = x_list
score_df = score_df.sort_values(by="score",ascending=False)
merge_score(x_list, score_df)
......
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