In [29]:
import pandas as pd
from datetime import datetime
from pandas.io.data import DataReader
import matplotlib.pyplot as plt

In [35]:
spx = DataReader("^GSPC", "yahoo", datetime(2000,1,1))
sso = DataReader("SSO", "yahoo", datetime(2000,1,1))
znga = DataReader("ZNGA", "yahoo", datetime(2013,1,1))
gluu = DataReader("GLUU", "yahoo", datetime(2013,1,1))
znga.head()


Out[35]:
Open High Low Close Volume Adj Close
Date
2013-01-02 2.41 2.45 2.34 2.39 19488000 2.39
2013-01-03 2.39 2.45 2.35 2.41 13589700 2.41
2013-01-04 2.43 2.69 2.42 2.63 36848200 2.63
2013-01-07 2.67 2.76 2.62 2.62 31078800 2.62
2013-01-08 2.59 2.62 2.48 2.50 14958100 2.50

5 rows × 6 columns


In [31]:
spx = spx.reindex(sso.index)
both = pd.DataFrame(data = {'spx': spx['Adj Close'], 'sso': sso['Adj Close']})
both.head()


Out[31]:
spx sso
Date
2006-06-21 1252.20 62.21
2006-06-22 1245.60 61.55
2006-06-23 1244.50 61.54
2006-06-26 1250.56 61.90
2006-06-27 1239.20 60.80

5 rows × 2 columns


In [32]:
both.plot()


Out[32]:
<matplotlib.axes.AxesSubplot at 0x4430290>

In [33]:
plt.show()

In [28]:


In [28]:


In [ ]: