I just read an article at https://www.analyticsvidhya.com/blog/2018/10/predicting-stock-price-machine-learningnd-deep-learning-techniques-python/ so I want to follow it to make a test.
I download Python and then copy the first part of the code to a .py file as below:
#import packages import pandas as pd import numpy as np #to plot within notebook import matplotlib.pyplot as plt %matplotlib inline #setting figure size from matplotlib.pylab import rcParams rcParams['figure.figsize'] = 20,10 #for normalizing data from sklearn.preprocessing import MinMaxScaler scaler = MinMaxScaler(feature_range=(0, 1)) #read the file df = pd.read_csv('NSE-TATAGLOBAL(1).csv') #print the head df.head()
But when running it, I get "Invalid syntax" error on the codeline:
After googling for the problem, I understand %xxx is a magic command and should be run with IPython. Therefore, I try to download Anaconda and install it on my computer. However, when I try to run the script in Spyder(I belive it is for IPython), I still get the same error.
How can I run the script in the article?