Excel,pickle
# -*- coding: utf-8 -*-
import pandas as pd
import pickle
xls_file_name='3.data2022.xls'
df = pd.read_excel(io=xls_file_name)
df = df.values.tolist()
# 保存 RA_list
f = open('RA_list.txt','wb')
pickle.dump(RA_list,f)
# 读取RA_list
f = open('RA_list.txt','rb')
RA_list= pickle.load(f)
f.close()
# list转dataframe
df = pd.DataFrame(new_df, columns=['序号','单位名称','许可证号','发证机关','分类'])
# 保存到本地excel,格式为 xlsx
df.to_excel("company_list.xlsx", index=False)
可以将EXCEL存为 CSV再读取
# -*- coding: utf-8 -*-
# 先将excel存档为csv,然后再处理
import csv
#读取csv文件
lines = []
with open("参会回执汇总.csv", "r",encoding='utf-8') as f:
reader = csv.reader(f)
for row in reader:
lines.append(row)
正文完