Trading with Machine Learning: Classification and SVM - code question

Hi,



in the final code for the course: Trading with Machine Learning: Classification and SVM



We will also pass two other values as features: the change in "Open" prices between yesterday and today & the difference between today's "Open" and yesterday's "Close" prices.



Df['OO']= Df['Open']-Df['Open'].shift(1)

Df['OC']= Df['Open']-Df['close']



Why does the second line not also have .shift(1)? In the description says yesterday's "Close" prices but without the .shift it's todays "Close" price - right? So it would look like this:

Df['OC']= Df['Open']-Df['close'].shift(1)



Thanks,

Wm



I

 

Hi William,



Thank you for the query. Please note that the code cell that you are referring to has the close column with a lower case 'c'. In the cell before this, we have mentioned that



Df['close'] = Df['Close'].shift(1)



So, the code cell that  you have mentioned earlier should be:



Df['OC']= Df['Open']-Df['Close'].shift(1)



or



Df['OC']= Df['Open']-Df['close']



Please let us know, if you have any further queries. Thank you.