python 写excel文件,多sheet

python 写excel文件,多sheet

from kettle.api import API
import pandas as pd
import sys
import json
output=pd.DataFrame()
funds=['110022.OF','110001.OF','050002.OF']
pd_writer = pd.ExcelWriter("fund_nav.xls")
for _fund in funds:
    acc = API.history(_fund, starttime='19000101')[['REPAIRUNITNAV']].reset_index()
    print acc.to_excel(pd_writer, sheet_name = _fund, index=False)
pd_writer.save()
pd_writer.close()

你可能感兴趣的:(python,excel)