pandas

pandas细节比较多,更新也快,绝对可以替代所有sql

0.13中ExcelWriter支持使用with写入多sheet,更人性化

with ExcelWriter('path_to_file.xlsx') as writer:

df1.to_excel(writer, sheet_name='Sheet1')

df2.to_excel(writer, sheet_name='Sheet2')

0.12中,需要用writer.save()保持才能输出

0.13ExcelWriter支持Excel writer engines

XlsxWriter —— .xlsx

openpyxl —— .xlsm files

xlwt —— .xls files

通过map实现多条件筛选

criterion = rdctemp[u'省名称'].map(lambda x: x.startswith(prov.decode('utf8')[:2]))

rdctemp.loc[criterion,dstname] = price