I'm trying to plot a stock prediction model. Everything is working fine until I try to index and plot.
valid['Predictions'] = 0
valid['Predictions'] = preds
valid.index = new_data[valid_nbr:].index
train.index = new_data[:train_nbr].index
plt.plot(train['Close'])
plt.plot(valid[['Close', 'Predictions']])
This is the error message I get after it runs:
/usr/lib/python3/dist-packages/ipykernel_launcher.py:2: 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/user_guide/indexing.html#returning-a-view-versus-a-copy
/usr/lib/python3/dist-packages/ipykernel_launcher.py:3: 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/user_guide/indexing.html#returning-a-view-versus-a-copy
This is separate from the ipykernel package so we can avoid doing imports until
How do I convert my code to follow the documentation the error provides? Thanks.