|
@@ -183,7 +183,7 @@ def add_func1(initial_df, pre_h_df):
|
|
|
|
|
|
|
|
|
|
def add_func2(initial_df, pre_h_df):
|
|
def add_func2(initial_df, pre_h_df):
|
|
- """当前小时级数据与前几个小时数据合并"""
|
|
|
|
|
|
+ """当前小时级数据与前几个小时数据合并: 当前小时存在的视频以当前小时为准,否则以高分为主"""
|
|
score_list = initial_df['score'].to_list()
|
|
score_list = initial_df['score'].to_list()
|
|
if len(score_list) > 0:
|
|
if len(score_list) > 0:
|
|
min_score = min(score_list)
|
|
min_score = min(score_list)
|
|
@@ -191,12 +191,16 @@ def add_func2(initial_df, pre_h_df):
|
|
min_score = 0
|
|
min_score = 0
|
|
initial_video_id_list = initial_df['videoid'].to_list()
|
|
initial_video_id_list = initial_df['videoid'].to_list()
|
|
pre_h_df = pre_h_df[pre_h_df['score'] > min_score]
|
|
pre_h_df = pre_h_df[pre_h_df['score'] > min_score]
|
|
|
|
+ print(f"pre1: {len(pre_h_df)}\n{pre_h_df}")
|
|
pre_h_df = pre_h_df[~pre_h_df['videoid'].isin(initial_video_id_list)]
|
|
pre_h_df = pre_h_df[~pre_h_df['videoid'].isin(initial_video_id_list)]
|
|
|
|
+ print(f"pre2: {len(pre_h_df)}\n{pre_h_df}")
|
|
|
|
+
|
|
df = pd.concat([initial_df, pre_h_df], ignore_index=True)
|
|
df = pd.concat([initial_df, pre_h_df], ignore_index=True)
|
|
# videoid去重,保留分值高
|
|
# videoid去重,保留分值高
|
|
df['videoid'] = df['videoid'].astype(int)
|
|
df['videoid'] = df['videoid'].astype(int)
|
|
df = df.sort_values(by=['score'], ascending=False)
|
|
df = df.sort_values(by=['score'], ascending=False)
|
|
df = df.drop_duplicates(subset=['videoid'], keep="first")
|
|
df = df.drop_duplicates(subset=['videoid'], keep="first")
|
|
|
|
+ print(f"initial = {len(initial_df)}, df = {len(df)}")
|
|
return df
|
|
return df
|
|
|
|
|
|
|
|
|
|
@@ -766,6 +770,7 @@ def h_rank_bottom(now_date, now_h, rule_params, region_code_list, rule_rank_h_fl
|
|
def h_timer_check():
|
|
def h_timer_check():
|
|
try:
|
|
try:
|
|
rule_rank_h_flag = sys.argv[1]
|
|
rule_rank_h_flag = sys.argv[1]
|
|
|
|
+ # rule_rank_h_flag = '24h'
|
|
if rule_rank_h_flag == '48h':
|
|
if rule_rank_h_flag == '48h':
|
|
rule_params = config_.RULE_PARAMS_REGION_APP_TYPE_48H
|
|
rule_params = config_.RULE_PARAMS_REGION_APP_TYPE_48H
|
|
else:
|
|
else:
|