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
f102f9d3
Commit
f102f9d3
authored
Nov 04, 2026
by
chenyuanjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
etsy版本country字段处理脏数据
parent
4fcfd8ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
ehunt_util.py
Pyspark_job/utils/ehunt_util.py
+5
-4
No files found.
Pyspark_job/utils/ehunt_util.py
View file @
f102f9d3
...
...
@@ -55,12 +55,13 @@ NO_VALUES = ['no', 'n', 'false', '0', '否']
def
country_to_cn
(
col_name
):
"""国家统一为中文
,空串/[] 置空,字典未命中保留原
值"""
"""国家统一为中文
:先去掉 [] 和引号(如 ['United States']),空值置空,字典未命中保留清洗后的
值"""
country_map
=
F
.
create_map
([
F
.
lit
(
x
)
for
x
in
chain
(
*
COUNTRY_MAP
.
items
())])
country_key
=
F
.
lower
(
F
.
trim
(
F
.
col
(
col_name
)))
country_clean
=
F
.
trim
(
F
.
regexp_replace
(
F
.
col
(
col_name
),
r"[\[\]'\"]"
,
''
))
country_key
=
F
.
lower
(
country_clean
)
return
F
.
when
(
country_key
.
isNull
()
|
country_key
.
isin
(
''
,
'[]
'
),
F
.
lit
(
None
)
)
.
otherwise
(
F
.
coalesce
(
country_map
[
country_key
],
F
.
trim
(
F
.
col
(
col_name
))
))
country_key
.
isNull
()
|
(
country_key
==
'
'
),
F
.
lit
(
None
)
)
.
otherwise
(
F
.
coalesce
(
country_map
[
country_key
],
country_clean
))
def
yes_no_to_cn
(
col_name
):
...
...
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