AttributeError:“ float”对象没有属性“ decode”

我正在尝试从我拥有的数据框中开出发票。我已经提取了数量,每笔费用的金额。 我正在使用Invoice Generator.api制作发票。

import os

from tempfile import NamedTemporaryFile

from InvoiceGenerator.api import Invoice, Item, Client, Provider, Creator

from InvoiceGenerator.pdf import SimpleInvoice


price=[10,20,30]
cols=['onion','tomato','potato']
columns=df.columns[1:]
os.environ["INVOICE_LANG"] = "en"
for i in range(0,3):
    rows = df.loc[i]
    client = Client(rows[1],
                address = rows[3],
                phone=rows[4])
    provider = Provider('XYZ Company',
                    address='ABC', 
                    phone='000000000',
                    bank_account='10', 
                    bank_code='2010',
                    note='For any further query please contact us on the given number')
    creator = Creator('XYZ Company')

    invoice = Invoice(client, provider, creator)

    invoice.currency_locale = 'en_US.UTF-8'
    k=0

    for j in range(5,len(columns)):
        if (rows[j]!=0):
            quantity=(rows[j]/price[k])
            invoice.add_item(Item(int(quantity), int(price[k]), description=cols[k]))
        k+=1
    pdf = SimpleInvoice(invoice)
    pdf.gen("invoice.pdf", generate_qr_code=True)

错误显示在代码的最后一行,即:    pdf.gen(“ invoice.pdf”,generate_qr_code = True) 当我运行此代码时,错误如下:    AttributeError:“ float”对象没有属性“ decode”。