Commit 62f91a09 authored by 赵威's avatar 赵威

get result

parent a5a58b9a
...@@ -6,6 +6,7 @@ from tool import get_tag3_user_log ...@@ -6,6 +6,7 @@ from tool import get_tag3_user_log
# [{'激光': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}] # [{'激光': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}]
# {'手术': 5.8475846946146195, '激光': 1.949194898204873}
def merge_values(list_of_dict): def merge_values(list_of_dict):
return dict(functools.reduce(operator.add, map(Counter, list_of_dict))) return dict(functools.reduce(operator.add, map(Counter, list_of_dict)))
...@@ -49,16 +50,24 @@ def update_tag3_user_portrait(cl_id): ...@@ -49,16 +50,24 @@ def update_tag3_user_portrait(cl_id):
second_positions_list = user_df["second_positions_dict"].tolist() second_positions_list = user_df["second_positions_dict"].tolist()
projects_list = user_df["projects_dict"].tolist() projects_list = user_df["projects_dict"].tolist()
print(first_solutions_list) res = {
print(merge_values(first_solutions_list), "\n") "first_demands": merge_values(first_demands_list),
"second_demands": merge_values(second_demands_list),
"first_solutions": merge_values(first_solutions_list),
"second_solutions": merge_values(second_solutions_list),
"first_positions": merge_values(first_positions_list),
"second_positions": merge_values(second_positions_list),
"projects": merge_values(projects_list)
}
print(second_solutions_list, "\n") # cl_id_portrait_key = "doris:test:device_id:" + str(cl_id)
print(merge_values(second_solutions_list)) # redis_client.set(cl_id_portrait_key, json.dumps(res))
# redis_client.expire(cl_id_portrait_key, 60*60*24)
print(first_demands_list, "\n") return res
print(merge_values(first_demands_list))
if __name__ == "__main__": if __name__ == "__main__":
cl_id = "866017030837899" cl_id = "866017030837899"
update_tag3_user_portrait(cl_id) res = update_tag3_user_portrait(cl_id)
print(res)
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