我正在尝试调用一个用python编写的AWS lambda函数,它需要一个2D数组作为输入,但是在解析该数组时,python代码会引发以下错误 “列表索引必须是整数或切片,而不是元组:TypeError”
正在解析此列表的代码
# Input:
# "utilityRates": [[0, 600, 0.2, 1, 366], [600, 900, 0.15, 1, 366], [900, 1440, 0.3, 1, 366]]
TempElectricityRate = request["utilityRates"]
print(TempElectricityRate)
ElectricityRate = numpy.zeros((3,5))
for x in range(0, 3):
ElectricityRate[x,0] = TempElectricityRate[x,0]
ElectricityRate[x,1] = TempElectricityRate[x,1]
ElectricityRate[x,2] = TempElectricityRate[x,2]
ElectricityRate[x,3] = TempElectricityRate[x,3]
ElectricityRate[x,4] = TempElectricityRate[x,4]