Screen Link:
My Code:
test = sp[sp["Date"]>datetime(2013,1,1)]
training_columns=["5 Day Price Avg", "30 Day Price Avg", "365 Day Price Avg"]
reg = linear_model.LinearRegression()
reg.fit(train[training_columns], train[["Close"]])
predictions = reg.predict(test[training_columns])
test["Predictions"] = predictions```
What I expected to happen:
I expect to add a new column to the test data frame with the predicted close values.
What actually happened:
predict.py:32: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
test[“Predictions”] = predictions
<!--Enter other relevant details below: -->