Commit 940661c9 by hejiangming

年度搜索词更新品牌标记

parent 0e084865
...@@ -486,7 +486,9 @@ class DwtAbaLast365(object): ...@@ -486,7 +486,9 @@ class DwtAbaLast365(object):
# 影视品牌标签 # 影视品牌标签
self.df_label = self.df_label.groupBy('search_term').agg( self.df_label = self.df_label.groupBy('search_term').agg(
F.round((F.sum("asin_movie_type_count") / F.sum("total_asin_num")) * 100, 2).alias('movie_prop'), F.round((F.sum("asin_movie_type_count") / F.sum("total_asin_num")) * 100, 2).alias('movie_prop'),
F.max('st_brand_label').alias('st_brand_label') # ===== 原逻辑(保留备查):F.max('st_brand_label') 12个月只要1个月标品牌就算品牌,旧月份拖累年表 =====
# 改为频率口径:12个月(固定分母)中 st_brand_label=1 的月数 >=6 才标品牌,<6 不标
F.when(F.sum('st_brand_label') >= 6, F.lit(1)).otherwise(F.lit(0)).alias('st_brand_label')
).withColumn( ).withColumn(
# 影视标记类型 0:非影视; 1:0< 比例 <= 20%; 2: 20% < 比例 <= 50%; 3:50% < 比例 # 影视标记类型 0:非影视; 1:0< 比例 <= 20%; 2: 20% < 比例 <= 50%; 3:50% < 比例
'st_movie_label', 'st_movie_label',
......
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