xlwings python类型错误图像对象

2024-09-27 21:32:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个xlwings函数(ChartXYZ()),它一直在正常工作。它将在excel中生成matplot图像。在

我现在添加了第二个xlwings函数(ChartSomethingElse()),它还添加了另一个matplot图像。我已确保新图像和旧图像的名称不同。在

问题是-我现在在我的第一个函数(ChartXYZ())上出现以下错误:

TypeError: Don't know what to do with that image object

第二个函数(ChartSomethingElse())工作正常并生成matplot。在

功能一:

@xls.func
def plotHistData(ticker,field,startDate,endDate):
        df = histdata(ticker,field,startDate,endDate)
        sht = xls.Book.caller().sheets.active
        fig = df.plot()
        sht.pictures.add(fig, name=ticker+' hist', update=True)
        return 'Plotted chart'

功能二:

^{pr2}$

Tags: 函数图像功能fielddffigxlwingsxls

热门问题