for i in range(122):
if i <= 121:
for j in range(6):
consumption = consumption + df2.loc[df2['Main Load [kWh]']]
pos = pos + 1
weekly_consumption=weekly_consumption.append(pos,consumption)
consumption = 0
else:
for j in range(1):
consumption = consumption + df2.loc[df2['Main Load [kWh]']]
pos = pos + 1
weekly_consumption=weekly_consumption.append(pos,consumption)
consumption = 0
答案 0 :(得分:1)
您不能对数字进行迭代,而只能对集合进行迭代。您可以尝试一系列数字,例如
for i in range(122):
或列表,字符串等,例如
for i in '122':