|
@@ -54,16 +54,17 @@ region_code = {
|
|
|
}
|
|
|
|
|
|
features = [
|
|
|
+ 'code',
|
|
|
'videoid',
|
|
|
'lastonehour_preview', # 过去1小时预曝光人数
|
|
|
'lastonehour_view', # 过去1小时曝光人数
|
|
|
'lastonehour_play', # 过去1小时播放人数
|
|
|
'lastonehour_share', # 过去1小时分享人数
|
|
|
'lastonehour_return', # 过去1小时分享,过去1小时回流人数
|
|
|
- 'lastonehour_preview_total_final', # 过去1小时预曝光次数
|
|
|
- 'lastonehour_view_total_final', # 过去1小时曝光次数
|
|
|
- 'lastonehour_play_total_final', # 过去1小时播放次数
|
|
|
- 'lastonehour_share_total_final', # 过去1小时分享次数
|
|
|
+ 'lastonehour_preview_total', # 过去1小时预曝光次数
|
|
|
+ 'lastonehour_view_total', # 过去1小时曝光次数
|
|
|
+ 'lastonehour_play_total', # 过去1小时播放次数
|
|
|
+ 'lastonehour_share_total', # 过去1小时分享次数
|
|
|
]
|
|
|
|
|
|
|
|
@@ -170,6 +171,7 @@ def video_rank(df, now_date, now_h, rule_key, param, region):
|
|
|
h_recall_df = df[(df['lastonehour_return'] >= return_count) & (df['score'] >= score_value)]
|
|
|
h_recall_videos = h_recall_df['videoid'].to_list()
|
|
|
log_.info(f'h_recall videos count = {len(h_recall_videos)}')
|
|
|
+
|
|
|
# 写入对应的redis
|
|
|
h_video_ids =[]
|
|
|
h_recall_result = {}
|
|
@@ -207,7 +209,8 @@ def rank_by_h(project, table, now_date, now_h, rule_params, region_code_list):
|
|
|
for region in region_code_list:
|
|
|
log_.info(f"region = {region}")
|
|
|
# 计算score
|
|
|
- score_df = cal_score(df=feature_df)
|
|
|
+ region_df = feature_df[feature_df['code'] == region]
|
|
|
+ score_df = cal_score(df=region_df)
|
|
|
video_rank(df=score_df, now_date=now_date, now_h=now_h, rule_key=key, param=value, region=region)
|
|
|
# to-csv
|
|
|
score_filename = f"score_{region}_{key}_{datetime.datetime.strftime(now_date, '%Y%m%d%H')}.csv"
|