Commit 15a09bfa authored by 赵威's avatar 赵威

update field

parent 2778698d
......@@ -69,6 +69,8 @@ def device_feature_engineering(df):
def diary_feature_engineering(df):
diary_df = df.copy()
str_bool_map = {"true": True, "false": False}
diary_df["first_demands"] = diary_df["first_demands"].str.split(",")
diary_df["second_demands"] = diary_df["second_demands"].str.split(",")
diary_df["first_solutions"] = diary_df["first_solutions"].str.split(",")
......@@ -84,6 +86,9 @@ def diary_feature_engineering(df):
diary_df["first_positions"] = diary_df["first_positions"].apply(lambda d: d if isinstance(d, list) else [])
diary_df["second_positions"] = diary_df["second_positions"].apply(lambda d: d if isinstance(d, list) else [])
diary_df["projects"] = diary_df["projects"].apply(lambda d: d if isinstance(d, list) else [])
diary_df["is_pure_author"].map(str_bool_map)
diary_df["is_have_pure_reply"].map(str_bool_map)
diary_df["is_have_reply"].map(str_bool_map)
diary_df["is_pure_author"] = diary_df["is_pure_author"].astype(int)
diary_df["is_have_pure_reply"] = diary_df["is_have_pure_reply"].astype(int)
diary_df["is_have_reply"] = diary_df["is_have_reply"].astype(int)
......
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