用Pandas数据框附加Excel工作表

时间:2019-01-19 15:29:19

标签: python pandas dataframe xlsxwriter

执行以下代码:

from nsepy import get_history
from datetime import date
from nsetools import Nse
import xlsxwriter

stock = Nse().get_stock_codes()
workbook = xlsxwriter.Workbook("HistoricalData.xlsx")
for i in stock.keys():
    data = get_history(symbol=i,start=date(2018,1,1),end=date(2018,1,31))
    worksheet = workbook.add_worksheet(i)
    worksheet.write("A1",data)
    if(i=="63MOONS"):
        break
workbook.close()

导致以下错误:

TypeError: Unsupported type <class 'pandas.core.frame.DataFrame'> in write()

如何解决这个问题?

0 个答案:

没有答案