Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
重
重点类信息提取
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ZGC_INDEX
重点类信息提取
Commits
986dd4f7
Commit
986dd4f7
authored
May 20, 2021
by
LAPTOP-1TK31LNP\liang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理类别错误数据
parent
d47d0e89
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
导出重点错误类别所有参数.py
公共代码/导出重点错误类别所有参数.py
+0
-0
类别更新导入数据库.py
公共代码/类别更新导入数据库.py
+9
-5
No files found.
公共代码/导出重点错误类别所有参数.py
0 → 100644
View file @
986dd4f7
This diff is collapsed.
Click to expand it.
公共代码/类别更新导入数据库.py
View file @
986dd4f7
...
...
@@ -40,10 +40,14 @@ def all_modify_SKU_name(product_name,category_name,product_category,DATABASE):
category_name_list
=
df_clean
[
category_name
]
.
tolist
()
product_category_list
=
df_clean
[
product_category
]
.
tolist
()
import_category_list
=
df_clean
[
"是否重点类"
]
.
tolist
()
print
(
import_category_list
)
#替换产品名称中错误的类别
for
i
in
product_name_list
:
#重点类,需要生成新sku名字
if
import_category_list
[
index_row
]
==
1
:
print
(
import_category_list
[
index_row
])
print
(
type
(
import_category_list
[
index_row
]))
if
import_category_list
[
index_row
]
==
1.0
:
print
(
"重点类"
)
temp
=
i
.
replace
(
category_name_list
[
index_row
],
""
)
temp_1
=
temp
.
replace
(
product_category_list
[
index_row
],
""
)
temp_final
=
temp_1
+
" "
+
category_name_list
[
index_row
]
...
...
@@ -51,9 +55,9 @@ def all_modify_SKU_name(product_name,category_name,product_category,DATABASE):
#非重点类,sku名字已经修改正确
else
:
list_temp
.
append
(
i
)
index_row
+=
1
print
(
"Through the list"
)
#检查替换后的列表
SKU_name
=
list_temp
print
(
SKU_name
)
return
SKU_name
...
...
@@ -234,13 +238,13 @@ product_name = '产品名称'
product_category
=
'产品类别'
category_name
=
'类别名称'
category_id
=
'类别编码'
database
=
'ZI_NEW
_TEST
'
database
=
'ZI_NEW'
test_database
=
'ZI_NEW_TEST'
#在跑之前只需改第243行得excel文件路径和第237行得库名
#df_clean = clean_excel(database)
df_excel
=
pd
.
read_excel
(
'
显示器产品类别分析0510.xlsx'
,
sheet_name
=
0
,
converters
=
{
'产品编码'
:
str
})
df_excel
=
pd
.
read_excel
(
'
平板电视类别分析0512_反馈.xlsx'
,
sheet_name
=
0
,
converters
=
{
'产品编码'
:
str
,
'类别名称'
:
str
,
'产品名称'
:
str
,
'产品品牌'
:
str
,
'产品类别'
:
str
,
'类别编码'
:
str
,
'是否为重点类'
:
int
,
'备注'
:
int
})
df_clean
=
df_excel
[
df_excel
[
'备注'
]
==
1
]
SKU_name
=
all_modify_SKU_name
(
product_name
,
category_name
,
product_category
,
database
)
SPU_name
=
all_modify_SPU_name
(
product_brand
,
category_name
)
...
...
@@ -250,7 +254,7 @@ SPU = all_match_SPU_name(database,database,SPU_name,CATEGORY_id,BRAND_id)
SKU
=
get_sku
(
sku
)
SPU_ID
=
get_spu_id
(
SPU
,
database
)
#print(SKU)
update_sku_data
(
database
,
SKU
,
SKU_name
,
SPU_ID
)
#
update_sku_data(database,SKU,SKU_name,SPU_ID)
#delete_data(SPU_name, test_database)删库内数据用的,少用
...
...
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