#creating dataframe with date and target variable
data = df.sort_index(ascending=True, axis=0)
new_data = pd.DataFrame(index=range(0,len(df)),columns=['Date', 'Close'])
#import packages
import pandas as pd
import numpy as np
#to plot 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-BSE.csv')
#print the head
df.head()
#setting index as date
df['Date'] = pd.to_datetime(df.Date,format ='%Y-%m-%d')
df.index = df['Date']
#plot
plt.figure(figsize=(16,8))
plt.plot(df['Close'], label='Close Price History')
Above is the code is the code as I got it from my *.ipynb file.
Now if you run it you will get a matlibplot error as shown below. I am ut how to get rid of it. It works fine on
jupyter notebook.
File "testx.py", line 11
%matplotlib inline
^
SyntaxError: invalid syntax
Now with that error corrected (please explain what to do to correct the error)
when we run the code this is the response that I get.
NameError Traceback (most recent call last)
<ipython-input-4-0549f4648bc4> in <module>
18
19
---> 20 (Timestamp('2013-10-08 00:00:00'),
21 Timestamp('2017-10-06 00:00:00'),
22 Timestamp('2017-10-09 00:00:00'),
NameError: name 'Timestamp' is not defined
Please explain what is wrong and how to correct the error.
Any help appreciated. Thanks in advance.
Respectfully,
ErnestTBass