Commit 682eb72a by hejiangming

搜索词周报告 排名变化率 填充

parent 9a8892d9
......@@ -319,17 +319,17 @@ class DwtStDetailWeek(object):
F.when(F.col('rank_12_week_ago').isNull(), None).otherwise(F.col('rank_12_week_ago') - F.col('rank'))
).withColumn(
'rank_change_rate_last_week',
F.when(F.col('rank_last_week').isNull(), None).otherwise(
F.when(F.col('rank_last_week').isNull(), F.lit(1000)).otherwise( # 本周有排名但上周没有,默认增长率1000(新进榜)
F.round((F.col('rank_last_week') - F.col('rank')) / F.col('rank_last_week'), 4)
)
).withColumn(
'rank_change_rate_4_week_ago',
F.when(F.col('rank_4_week_ago').isNull(), None).otherwise(
F.when(F.col('rank_4_week_ago').isNull(), F.lit(1000)).otherwise( # 本周有排名但4周前没有,默认增长率1000
F.round((F.col('rank_4_week_ago') - F.col('rank')) / F.col('rank_4_week_ago'), 4)
)
).withColumn(
'rank_change_rate_12_week_ago',
F.when(F.col('rank_12_week_ago').isNull(), None).otherwise(
F.when(F.col('rank_12_week_ago').isNull(), F.lit(1000)).otherwise( # 本周有排名但12周前没有,默认增长率1000
F.round((F.col('rank_12_week_ago') - F.col('rank')) / F.col('rank_12_week_ago'), 4)
)
).cache()
......
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