Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
Amazon-Selection-Data
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abel_cjy
Amazon-Selection-Data
Commits
d6c5d1af
Commit
d6c5d1af
authored
Jul 17, 2026
by
hejiangming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
c172a17b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
dwt_bs_top100.py
Pyspark_job/dwt/dwt_bs_top100.py
+3
-3
dwt_bs_top100_change_rate.py
Pyspark_job/dwt/dwt_bs_top100_change_rate.py
+2
-2
No files found.
Pyspark_job/dwt/dwt_bs_top100.py
View file @
d6c5d1af
...
@@ -74,7 +74,7 @@ class DwtBsTop100(Templates):
...
@@ -74,7 +74,7 @@ class DwtBsTop100(Templates):
print
(
"df_cate_bs_data数量"
,
self
.
df_cate_bs_data
.
count
())
print
(
"df_cate_bs_data数量"
,
self
.
df_cate_bs_data
.
count
())
# 读利润率数据(dim_asin_profit_rate_info)——给每个 ASIN 补"海运/空运
毛
利润率",
# 读利润率数据(dim_asin_profit_rate_info)——给每个 ASIN 补"海运/空运利润率",
sql_pr
=
f
"""select asin, price as asin_price, ocean_profit, air_profit
sql_pr
=
f
"""select asin, price as asin_price, ocean_profit, air_profit
from dim_asin_profit_rate_info where site_name='{self.site_name}'"""
from dim_asin_profit_rate_info where site_name='{self.site_name}'"""
print
(
f
"2. 读取利润率数据: sql -- {sql_pr}"
)
print
(
f
"2. 读取利润率数据: sql -- {sql_pr}"
)
...
@@ -559,7 +559,7 @@ class DwtBsTop100(Templates):
...
@@ -559,7 +559,7 @@ class DwtBsTop100(Templates):
F
.
avg
(
"asin_rating"
)
.
alias
(
"asin_rating"
),
F
.
avg
(
"asin_rating"
)
.
alias
(
"asin_rating"
),
F
.
avg
(
"asin_bs_cate_1_rank"
)
.
alias
(
"asin_bs_cate_1_rank"
),
F
.
avg
(
"asin_bs_cate_1_rank"
)
.
alias
(
"asin_bs_cate_1_rank"
),
F
.
avg
(
"asin_total_comments"
)
.
alias
(
"asin_total_comments"
),
F
.
avg
(
"asin_total_comments"
)
.
alias
(
"asin_total_comments"
),
# 类目下海运/空运平均
毛
利润率 利润率为空的产品不计入
# 类目下海运/空运平均利润率 利润率为空的产品不计入
# 只对有利润率数据的 ASIN 求平均。整组全空 → avg 返回 null
# 只对有利润率数据的 ASIN 求平均。整组全空 → avg 返回 null
F
.
avg
(
"asin_ocean_freight_gross_margin"
)
.
alias
(
"asin_ocean_freight_gross_margin_avg"
),
F
.
avg
(
"asin_ocean_freight_gross_margin"
)
.
alias
(
"asin_ocean_freight_gross_margin_avg"
),
F
.
avg
(
"asin_air_freight_gross_margin"
)
.
alias
(
"asin_air_freight_gross_margin_avg"
),
F
.
avg
(
"asin_air_freight_gross_margin"
)
.
alias
(
"asin_air_freight_gross_margin_avg"
),
...
@@ -841,7 +841,7 @@ class DwtBsTop100(Templates):
...
@@ -841,7 +841,7 @@ class DwtBsTop100(Templates):
self
.
df_level_concat
=
self
.
df_level_concat
.
withColumn
(
self
.
df_level_concat
=
self
.
df_level_concat
.
withColumn
(
"asin_bsr_orders_sum_rate_brand"
,
F
.
round
(
"asin_bsr_orders_sum_rate_brand"
,
4
)
"asin_bsr_orders_sum_rate_brand"
,
F
.
round
(
"asin_bsr_orders_sum_rate_brand"
,
4
)
)
)
# 海运/空运平均
毛
利润率:比例,round(4)。整组全空(该分类下无任一 ASIN 有利润率) → avg 返回 null。
# 海运/空运平均利润率:比例,round(4)。整组全空(该分类下无任一 ASIN 有利润率) → avg 返回 null。
# 【和其它均值列不同】此列无值时直接落 null(不填 -1/-1000 占位)——已与后端确认利润率列可收 null。
# 【和其它均值列不同】此列无值时直接落 null(不填 -1/-1000 占位)——已与后端确认利润率列可收 null。
# 好处:null 天然不参与 同比环比的算术;坏处/注意:落表 save_data 时这批利润率列不能 na.fill。
# 好处:null 天然不参与 同比环比的算术;坏处/注意:落表 save_data 时这批利润率列不能 na.fill。
self
.
df_level_concat
=
self
.
df_level_concat
.
withColumn
(
self
.
df_level_concat
=
self
.
df_level_concat
.
withColumn
(
...
...
Pyspark_job/dwt/dwt_bs_top100_change_rate.py
View file @
d6c5d1af
...
@@ -46,8 +46,8 @@ class DwtBsTop100ChangeRate(object):
...
@@ -46,8 +46,8 @@ class DwtBsTop100ChangeRate(object):
(
'asin_price_mean'
,
'up'
),
# 平均价格
(
'asin_price_mean'
,
'up'
),
# 平均价格
(
'asin_rating_mean'
,
'up'
),
# 平均评分
(
'asin_rating_mean'
,
'up'
),
# 平均评分
(
'asin_total_comments_mean'
,
'up'
),
# 平均评论数
(
'asin_total_comments_mean'
,
'up'
),
# 平均评论数
(
'asin_ocean_freight_gross_margin_avg'
,
'profit'
),
# 海运平均
毛
利润率(需求3新增)
(
'asin_ocean_freight_gross_margin_avg'
,
'profit'
),
# 海运平均利润率(需求3新增)
(
'asin_air_freight_gross_margin_avg'
,
'profit'
),
# 空运平均
毛
利润率(需求3新增)
(
'asin_air_freight_gross_margin_avg'
,
'profit'
),
# 空运平均利润率(需求3新增)
]
]
# 跨月对齐主键:分类多归属(同 current_id 挂多个父级路径=多行),只用 current_id 会 1:N 串行。
# 跨月对齐主键:分类多归属(同 current_id 挂多个父级路径=多行),只用 current_id 会 1:N 串行。
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment