Commit 50efa5a7 authored by 张彦钊's avatar 张彦钊

delete prints

parent 4e3e5689
...@@ -22,8 +22,6 @@ def get_video_id(): ...@@ -22,8 +22,6 @@ def get_video_id():
result = cursor.fetchall() result = cursor.fetchall()
df = pd.DataFrame(list(result)) df = pd.DataFrame(list(result))
video_id = df[0].values.tolist() video_id = df[0].values.tolist()
print("video_id候选集")
print(video_id[:80])
db.close() db.close()
return video_id return video_id
...@@ -77,21 +75,17 @@ def save_result(queue_name,queue_arg,device_id): ...@@ -77,21 +75,17 @@ def save_result(queue_name,queue_arg,device_id):
score_df["cid"] = queue_arg[0] score_df["cid"] = queue_arg[0]
# 去掉cid前面的"diary|" # 去掉cid前面的"diary|"
score_df["cid"] = score_df["cid"].apply(lambda x:x[6:]) score_df["cid"] = score_df["cid"].apply(lambda x:x[6:])
print("score_df:") # print("score_df:")
print(score_df.head(1)) # print(score_df.head(1))
print(score_df.shape) # print(score_df.shape)
if queue_arg[1] != []: if queue_arg[1] != []:
df_temp = pd.DataFrame(queue_arg[1]).rename(columns={0: "cid"}) df_temp = pd.DataFrame(queue_arg[1]).rename(columns={0: "cid"})
df_temp["score"] = 0 df_temp["score"] = 0
df_temp = df_temp.sort_index(axis=1,ascending=False) df_temp = df_temp.sort_index(axis=1,ascending=False)
df_temp["cid"] = df_temp["cid"].apply(lambda x: x[6:]) df_temp["cid"] = df_temp["cid"].apply(lambda x: x[6:])
print("temp_df:")
print(df_temp.head(1))
print(df_temp.shape)
predict_score_df = score_df.append(df_temp) predict_score_df = score_df.append(df_temp)
print("score_df:")
print(predict_score_df.head(1))
print(predict_score_df.shape)
return predict_score_df return predict_score_df
else: else:
...@@ -116,8 +110,6 @@ def update_dairy_queue(score_df,predict_score_df,total_video_id): ...@@ -116,8 +110,6 @@ def update_dairy_queue(score_df,predict_score_df,total_video_id):
video_id = list(set(diary_id)&set(total_video_id)) video_id = list(set(diary_id)&set(total_video_id))
print("video_id:")
print(video_id)
if len(video_id)>0: if len(video_id)>0:
not_video = list(set(diary_id) - set(video_id)) not_video = list(set(diary_id) - set(video_id))
# 为了相加时cid能够匹配,先把cid变成索引 # 为了相加时cid能够匹配,先把cid变成索引
...@@ -158,8 +150,7 @@ def update_sql_dairy_queue(queue_name, diary_id,device_id, city_id): ...@@ -158,8 +150,7 @@ def update_sql_dairy_queue(queue_name, diary_id,device_id, city_id):
id_str = str(diary_id[0]) id_str = str(diary_id[0])
for i in range(1, len(diary_id)): for i in range(1, len(diary_id)):
id_str = id_str + "," + str(diary_id[i]) id_str = id_str + "," + str(diary_id[i])
print("写入前")
print(id_str[:80])
sql = "update device_diary_queue set {}='{}' where device_id = '{}' and city_id = '{}'".format\ sql = "update device_diary_queue set {}='{}' where device_id = '{}' and city_id = '{}'".format\
(queue_name,id_str,device_id, city_id) (queue_name,id_str,device_id, city_id)
cursor.execute(sql) cursor.execute(sql)
...@@ -197,7 +188,7 @@ def get_queue(device_id, city_id,queue_name): ...@@ -197,7 +188,7 @@ def get_queue(device_id, city_id,queue_name):
cursor.execute(sql) cursor.execute(sql)
result = cursor.fetchall() result = cursor.fetchall()
df = pd.DataFrame(list(result)) df = pd.DataFrame(list(result))
print(df)
if df.empty: if df.empty:
print("该用户对应的日记为空") print("该用户对应的日记为空")
return False return False
...@@ -218,8 +209,7 @@ def pipe_line(queue_name, queue_arg, device_id,total_video_id): ...@@ -218,8 +209,7 @@ def pipe_line(queue_name, queue_arg, device_id,total_video_id):
return False return False
else: else:
score_df = score_df.rename(columns={0: "score", 1: "cid"}) score_df = score_df.rename(columns={0: "score", 1: "cid"})
print("日记打分表")
print(score_df.head(1))
diary_queue = update_dairy_queue(score_df, predict_score_df,total_video_id) diary_queue = update_dairy_queue(score_df, predict_score_df,total_video_id)
return diary_queue return diary_queue
......
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