1 2 3 4 5 6 7 8 9
| import pandas as pd data = pd.read_excel(r'地址\汇总.xls',keep_default_na=False) unit_list = list(data['姓名'].drop_duplicates()) for i in unit_list: data_new = data[data['姓名'] == i] if i == '': data_new.to_excel() else: data_new.to_excel(r"地址\%s.xls" % (i),index=False)
|