-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrammar.py
More file actions
33 lines (26 loc) · 810 Bytes
/
grammar.py
File metadata and controls
33 lines (26 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import pandas as pd
import pandas_datareader.data as web
import datetime
import matplotlib.pyplot as plt
from IPython import get_ipython
python_shell = get_ipython()
if python_shell == None:
print ('None')
else:
get_ipython().run_line_magic('matplotlib','inline')
#%matplotlib inline
#%pylab inline
start = datetime.datetime(2017,1,1)
end = datetime.date.today()
apple = web.DataReader("AAPL","yahoo",start,end)
microsoft = web.DataReader("MSFT","yahoo",start,end)
google = web.DataReader("GOOG","yahoo",start,end)
#type(apple)
print (apple.head())
stock = pd.DataFrame({"AAPL": apple["Adj Close"],
"MSFT": microsoft["Adj Close"],
"GOOG": google["Adj Close"]})
print (stock.head())
#apple["Adj Close"].plot(grid = True)
stock.plot(grid = True)
plt.show()