如何在循环中附加pd.series输出
输入
for hours in fun(data, 24*10):
model.fit(hours)
df['output'] = pd.Series(model.predict(hours))
我想要这样的东西
lst=[]
for hours in fun(data, 24*10):
model.fit(hours)
x = pd.Series(model.predict(hours))
lst.append(x)
df['output'] = pd.DataFrame(lst)
答案 0 :(得分:1)
pd.concat应该可以工作:
lst=[]
for hours in fun(data, 24*10):
model.fit(hours)
x = pd.Series(model.predict(hours))
lst.append(x)
df['output'] = pd.concat(lst, axis=0)