Help with predicting stock prices python deep learning

hi, i am writing about a rather old article about 3 years ago. Here is the link: https://www.analyticsvidhya.com/blog/2018/10/predicting-stock-price-machine-learningnd-deep-learning-techniques-python/

I have been trying out the last method described in the article: the LSTM method for predicting stock prices. I am using Nike’s dataset from Yahoo Finance for the last 5 years. The code runs properly until the last portion. This is the portion of code with the error (it is the plotting of the graph)

#for plotting
train = new_data[:987]
valid = new_data[987:]
valid[‘Predictions’] = closing_price
plt.plot(train[‘Close’])
plt.plot(valid[[‘Close’,‘Predictions’]])

Running the program, I get this error:
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.

This has to do with the line: valid['Predictions] = closing_price

Could you provide some help as to what is done wrong here? I understand it is a rather old article. However, I would really appreciate your help as this is for a school project. Thank you so much!

© Copyright 2013-2020 Analytics Vidhya