Reputation: 821
How can I append the pd.series output in a loop
Input
for hours in fun(data, 24*10):
model.fit(hours)
df['output'] = pd.Series(model.predict(hours))
I want something like this
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)
Upvotes: 0
Views: 508
Reputation: 3929
pd.concat should work:
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)
Upvotes: 1