Commit 5f7f3949 authored by Jialin's avatar Jialin

代码更新

parent 62dacfbd
......@@ -33,6 +33,7 @@ def product_washing(filepath, category, thre=1, a=0):
for param in other_parameters_fetch:
other_parameters.append(param[0])
point_category_list = ['台式机', '笔记本', '一体电脑', '复印纸']
related_product = []
brand_grouped = df.groupby(by='产品品牌')
for brand in brand_grouped:
......@@ -41,6 +42,15 @@ def product_washing(filepath, category, thre=1, a=0):
tempo_dict = {}
# 每个品牌提取产品型号关键字,放入tempo_dict
for i in brand[1].index:
if category in point_category_list:
if category == '复印纸':
k = brand[1].loc[i, '*产品系列']
else:
k = brand[1].loc[i, '*产品子系列']
k.replace(' ','').replace('系列','').replace('_','').replace('-','').upper()
tempo_dict[i] = [k]
else:
k = brand[1].loc[i, '*产品型号']
if k in invalid_list:
continue
......@@ -119,7 +129,10 @@ def product_washing(filepath, category, thre=1, a=0):
if count != 0:
tested_product.append(set([i, j]))
break # 如果出现了必须相等但不相等的参数,则退出到上一层循环。如果没有出现,则对比型号
if category in point_category_list:
if tempo_dict[i][0] == tempo_dict[j][0]:
related_product.append(set([i, j]))
else:
accuracy_i=0
accuracy_j=0
for word_i in tempo_dict[i][0]:
......@@ -179,6 +192,6 @@ def product_washing(filepath, category, thre=1, a=0):
if __name__ == '__main__':
filepath = "E:\\ZDZC\\激光打印机参数确认.xlsx"
category = '激光打印机'
filepath = "E:\\ZDZC\\Sourcetree_local\\公共代码\\一体电脑参数确认.xlsx"
category = '一体电脑'
product_washing(filepath,category)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment