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
62de3426
Commit
62de3426
authored
Jul 23, 2026
by
chenyuanjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
标题匹配度计算优化
parent
e5539dce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
10 deletions
+3
-10
dwt_flow_asin.py
Pyspark_job/dwt/dwt_flow_asin.py
+3
-10
No files found.
Pyspark_job/dwt/dwt_flow_asin.py
View file @
62de3426
...
@@ -600,16 +600,9 @@ class DwtFlowAsin(Templates):
...
@@ -600,16 +600,9 @@ class DwtFlowAsin(Templates):
# 处理匹配度
# 处理匹配度
def
handle_title_matching_degree
(
self
):
def
handle_title_matching_degree
(
self
):
window
=
Window
.
partitionBy
(
"asin"
)
self
.
df_title_matching_degree
=
self
.
df_title_matching_degree
.
groupBy
(
'asin'
)
.
agg
(
self
.
df_title_matching_degree
=
self
.
df_title_matching_degree
.
withColumn
(
F
.
round
(
F
.
sum
(
'contains_flag'
)
/
F
.
count
(
'asin'
),
4
)
.
alias
(
'title_matching_degree'
)
"asin_count"
,
F
.
count
(
"asin"
)
.
over
(
window
))
)
# 统计每个asin中,flag为1的数量
self
.
df_title_matching_degree
=
self
.
df_title_matching_degree
.
withColumn
(
"contains_count"
,
F
.
sum
(
"contains_flag"
)
.
over
(
window
))
self
.
df_title_matching_degree
=
self
.
df_title_matching_degree
.
withColumn
(
"title_matching_degree"
,
F
.
round
(
F
.
col
(
"contains_count"
)
/
F
.
col
(
"asin_count"
),
4
))
self
.
df_title_matching_degree
=
self
.
df_title_matching_degree
.
drop
(
"asin_count"
,
"contains_count"
,
"contains_flag"
)
self
.
df_title_matching_degree
=
self
.
df_title_matching_degree
.
drop_duplicates
([
'asin'
])
self
.
df_asin_detail
=
self
.
df_asin_detail
.
join
(
self
.
df_title_matching_degree
,
on
=
[
'asin'
],
how
=
'left'
)
self
.
df_asin_detail
=
self
.
df_asin_detail
.
join
(
self
.
df_title_matching_degree
,
on
=
[
'asin'
],
how
=
'left'
)
self
.
df_title_matching_degree
.
unpersist
()
self
.
df_title_matching_degree
.
unpersist
()
...
...
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