Python 类型错误:';浮动';对象没有属性'__获取项目';使用reportLab时

Python 类型错误:';浮动';对象没有属性'__获取项目';使用reportLab时,python,python-2.7,charts,reportlab,Python,Python 2.7,Charts,Reportlab,我知道有很多问题都是同名的,但我找不到一个有相同问题点的问题。 我正在使用reportLab创建图表,并希望将图形保存到文件中,但出现上述错误。 以下是我所拥有的: from reportlab.graphics.shapes import Drawing from reportlab.graphics.charts.barcharts import VerticalBarChart from reportlab.graphics import renderPDF class Charts:

我知道有很多问题都是同名的,但我找不到一个有相同问题点的问题。 我正在使用reportLab创建图表,并希望将图形保存到文件中,但出现上述错误。 以下是我所拥有的:

from reportlab.graphics.shapes import Drawing
from reportlab.graphics.charts.barcharts import VerticalBarChart
from reportlab.graphics import renderPDF

class Charts:
    def __init__(self):
        self.d = Drawing(300, 200)


    def drawChart(self, list1, list2):
        chart = VerticalBarChart()
        chart.width = 260
        chart.height = 160
        chart.x = 20
        chart.y = 20
        chart.data = list2
        chart.categoryAxis.categoryNames = list1
        chart.valueAxis.valueMin = 0
        self.d.add(chart)
        renderPDF.drawToFile(self.d, 'example1.pdf', 'My First Drawing')
错误语句很长,因此到此结束:

 File "/usr/lib/python2.7/dist-packages/reportlab/graphics/charts/axes.py", line 49, in _findMinMaxValue
if isinstance(V[0][0],_SequenceTypes):
TypeError: 'float' object has no attribute '__getitem__'

提前谢谢

检查
list1
list2
的类型。list2是浮动列表,list1是stringsooh列表,我找到了。列表2应该是一个浮动列表的列表。它现在可以工作了=)