1. 安装pandas
pip install pandas -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
2. 逐行读取数据示例
try:
sheet = pandas.read_excel("my_excel.xlsx", "my_sheet")
for row in sheet.index.values :
doc = dict()
doc['key1'] = sheet.iloc[row, 0]
doc['key2'] = sheet.iloc[row, 1]
except Exception as e:
print(e)
return
Pandas安装与Excel数据读取
本文介绍如何使用pip安装Pandas库,并提供了一个示例,展示如何从Excel文件中逐行读取数据,将每一行转换为字典格式,便于进一步的数据处理和分析。
1441





