154cff10 by 周伟奇

update classify

1 parent a8c68474
......@@ -38,7 +38,7 @@ class BSWorkbook(Workbook):
for col in range(consts.FIXED_COL_AMOUNT + 1, ws.max_column + 1):
header_value = ws.cell(1, col).value
header_col = consts.HEADERS_MAPPING.get(header_value)
if header_col is not None:
if header_col is not None and header_col not in header_col_set:
letter = get_column_letter(col)
ws.move_range("{0}1:{0}{1}".format(letter, ws.max_row), cols=header_col - col)
moved_col_set.add(col)
......@@ -63,7 +63,7 @@ class BSWorkbook(Workbook):
for header_col in range(1, consts.FIXED_COL_AMOUNT + 1):
if header_col in header_col_set or header_col == consts.RESULT_HEADER_COL:
continue
fix_col = consts.CLASSIFY_LIST[classify][1][header_col - 1] # TODO 合并分类情况
fix_col = consts.CLASSIFY_LIST[classify][1][header_col - 1]
if fix_col is None:
continue
fix_col = fix_col + consts.FIXED_COL_AMOUNT
......@@ -250,7 +250,7 @@ class BSWorkbook(Workbook):
# 3.4.余额转数值
try:
try:
if isinstance(amount_cell.value, str):
if isinstance(amount_cell.value, str): # TODO 可在转化数字失败后,再替换
amount_cell.value = amount_cell.value.translate(consts.TRANS)
amount_cell.value = locale.atof(amount_cell.value)
except Exception as e:
......@@ -337,8 +337,6 @@ class BSWorkbook(Workbook):
end_date = max(date_list) if end_date is None else end_date
# 2.元信息提取表
bank_name = consts.CLASSIFY_LIST[summary['classify']][0]
base_sheet_name = '{0}_{1}'.format(bank_name, summary['role'])
ms = self.build_meta_sheet(card,
summary['classify'],
summary['confidence'],
......@@ -354,7 +352,7 @@ class BSWorkbook(Workbook):
is_reverse = True
for month_list in month_mapping.values():
month_list.sort(key=lambda x: x[-1], reverse=True)
self.build_month_sheet(base_sheet_name, month_mapping, ms, is_reverse)
self.build_month_sheet(card, month_mapping, ms, is_reverse)
# 4.删除原表
for sheet in summary['sheet']:
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!