pomscripts/excelSheetSplit.py

20 lines
515 B
Python
Raw Normal View History

2023-04-04 04:15:34 +00:00
import pandas as pd
s = '2023-03-06_11.34.42'
strP = 'D:/Projects/POM/DATA/search/' + s + '/'
strFn = s + '_mm.xlsx'
strP = 'D:/Projects/POM/DATA/2023年3月/两会/敏感词3月13日/上报/'
strFn = 'MGC2023.3.13.xlsx'
df = pd.read_excel(strP+strFn)
print(strP+strFn)
print(df.shape)
cities = df['市州'].unique()
print(cities)
for city in cities:
print(city)
dft = df[df['市州'].isin([city])]
print(dft.shape)
# exec("df%s = dft"%cityNum)
dft.to_excel(strP + city+'.xlsx', index= False)