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
f2887063
Commit
f2887063
authored
Apr 05, 2021
by
rico.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
61e2445b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
12 deletions
+24
-12
Excel数据处理func.py
Excel数据处理func.py
+24
-12
No files found.
Excel数据处理func.py
View file @
f2887063
...
...
@@ -206,15 +206,27 @@ def SkuMatch(df,channel_alias,engine):
zi_subcategoryname
=
df_his
[
'zi_subcategoryname'
]
.
tolist
()[
0
]
.
replace
(
"'"
,
"''"
)
zi_subcategorycode
=
df_his
[
'zi_subcategorycode'
]
.
tolist
()[
0
]
.
replace
(
"'"
,
"''"
)
model
=
df_his
[
'model'
]
.
tolist
()[
0
]
remark
=
df_his
[
'remark'
]
.
tolist
()[
0
]
try
:
params_standard
=
df_his
[
'params_standard'
]
.
tolist
()[
0
]
.
replace
(
"'"
,
"''"
)
print
(
f
"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',params_standard = '{params_standard}',state = '8' where id = {id_}"
)
cursor_zi_service
.
execute
(
f
"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',params_standard = '{params_standard}',remark='{remark}',state = '8' where id = {id_}"
)
except
:
print
(
f
"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',state = '8' where id = {id_}"
)
cursor_zi_service
.
execute
(
f
"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',remark='{remark}',state = '8' where id = {id_}"
)
remark
=
str
(
df_his
[
'remark'
]
.
tolist
()[
0
])
if
remark
==
'None'
:
try
:
params_standard
=
df_his
[
'params_standard'
]
.
tolist
()[
0
]
.
replace
(
"'"
,
"''"
)
print
(
f
"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',params_standard = '{params_standard}',state = '8' where id = {id_}"
)
cursor_zi_service
.
execute
(
f
"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',params_standard = '{params_standard}',remark=Null,state = '8' where id = {id_}"
)
except
:
print
(
f
"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',state = '8' where id = {id_}"
)
cursor_zi_service
.
execute
(
f
"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',remark=Null,state = '8' where id = {id_}"
)
else
:
try
:
params_standard
=
df_his
[
'params_standard'
]
.
tolist
()[
0
]
.
replace
(
"'"
,
"''"
)
print
(
f
"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',params_standard = '{params_standard}',state = '8' where id = {id_}"
)
cursor_zi_service
.
execute
(
f
"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',params_standard = '{params_standard}',remark='{remark}',state = '8' where id = {id_}"
)
except
:
print
(
f
"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',state = '8' where id = {id_}"
)
cursor_zi_service
.
execute
(
f
"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',remark='{remark}',state = '8' where id = {id_}"
)
else
:
code
=
res_dict
[
sku
]
...
...
@@ -1357,7 +1369,7 @@ def create_to_db(path,std_value_dict):
spuid_list
=
list
()
for
index
,
row
in
df
.
iterrows
():
if
(
row
[
'remark'
]
!=
'nan'
and
row
[
'remark'
]
!=
'None'
)
or
(
row
[
'productcode'
]
!=
'nan'
and
row
[
'productcode'
]
!=
'None'
):
if
(
row
[
'remark'
]
!=
'nan'
and
row
[
'remark'
]
!=
'None'
and
row
[
'remark'
]
!=
'未匹配上产品'
)
or
(
row
[
'productcode'
]
!=
'nan'
and
row
[
'productcode'
]
!=
'None'
):
new_name_list
.
append
(
" "
)
continue
...
...
@@ -1512,7 +1524,7 @@ def create_to_db(path,std_value_dict):
df
[
'new_name'
]
=
new_name_list
for
index
,
row
in
df
.
iterrows
():
if
row
[
'remark'
]
!=
'nan'
and
row
[
'remark'
]
!=
'None'
:
#驳回数据
if
row
[
'remark'
]
!=
'nan'
and
row
[
'remark'
]
!=
'None'
and
row
[
'remark'
]
!=
'未匹配上产品'
:
#驳回数据
new_product_flag_list
.
append
(
'0'
)
new_name_update
=
row
[
'new_name'
]
.
replace
(
"'"
,
"
\'
"
)
#print(1,f"update product_all set state = '2',new_name = '{new_name_update}',remark = '{row['remark']}' where id = {row['id']}")
...
...
@@ -2027,7 +2039,7 @@ def update_non_point_to_db(path,mode):
counter
+=
1
except
:
print
(
index_
(
counter
,
1
),
end
=
'
%
'
)
if
remark
==
'nan'
or
remark
==
'null'
:
if
remark
==
'nan'
or
remark
==
'null'
or
remark
==
'未匹配上产品'
:
if
matchcode
==
'nan'
:
newname
=
str
(
newname
)
.
replace
(
"'"
,
"''"
)
brand
=
str
(
brand
)
.
replace
(
"'"
,
"''"
)
...
...
@@ -2065,7 +2077,7 @@ def update_non_point_to_db(path,mode):
counter
+=
1
except
:
print
(
index_
(
counter
,
1
),
end
=
'
%
'
)
if
remark
==
'nan'
or
remark
==
'null'
:
if
remark
==
'nan'
or
remark
==
'null'
or
remark
==
'未匹配上产品'
:
if
matchcode
==
'nan'
:
newname
=
str
(
newname
)
.
replace
(
"'"
,
"''"
)
brand
=
str
(
brand
)
.
replace
(
"'"
,
"''"
)
...
...
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