pomscripts/excelSplit.py

21 lines
640 B
Python
Raw Normal View History

2023-04-04 04:15:34 +00:00
import pandas as pd
strP = 'D:/Projects/POM/DATA/2023年3月/3月13日错敏词/'
strFn1 = '敏感词.xlsx'
strFn2 = '错别字.xlsx'
sheets1 = pd.read_excel(strP+strFn1, sheet_name=None)
sheets2 = pd.read_excel(strP+strFn2, sheet_name=None)
sheetnames = sheets1.keys()
if len(sheets2.keys()) > len(sheets1.keys()) :
sheets = sheets2
d = pd.DataFrame()
for name in sheetnames:
v = pd.DataFrame()
if name in sheets1.keys():
v = pd.concat([v, sheets1[name]], axis=0)
if name in sheets2.keys():
v = pd.concat([v, sheets2[name]], axis=0)
p = pd.concat([d, ])
v.to_excel(strP+name+'.xlsx', index=False)