pandas 处理excel 导入

#coding:utf-8
import pandas as pd
df=pd.read_excel('E:\xxxx.xls')
test_data={}
for i in df.index.values[:3]: #也可以在这里定义取几条数据
    row_data=df.ix[i,['err_msg','ori_openid','id']].to_dict()  #['err_msg','ori_openid','id']  这个为列名非中文命名
    print row_data['err_msg']  #可单独取出数据  也可直接 obj.objects.create(**row_data),前提是列名要和字段名相同

猜你喜欢

转载自blog.csdn.net/QQ1752506968/article/details/90212061