-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Learning NumPy Array
By :

We will try to correlate stock market data for the Netherlands with the DataFrame we produced last time from the KNMI De Bilt weather data. As a proxy for the stock market, we will use closing prices of the EWN ETF. This might not be the best choice, by the way, so if you have a better idea, please use the appropriate stock ticker. The steps for this exercise are provided as follows:
Download the EWN data from Yahoo Finance, with a special function. The code is as follows:
#EWN start Mar 22, 1996 start = dt(1996, 3, 22) end = dt(2013, 5, 4) symbol = "EWN" quotes = finance.quotes_historical_yahoo(symbol, start, end, asobject=True)
Create a DataFrame
object with the available dates in the downloaded data:
df2 = pd.DataFrame(quotes.close, index=dt_idx, columns=[symbol])
Join the new DataFrame
object with DataFrame
of the weather data. We will then obtain the correlation matrix:
df3 = df.join(df2) print df3.corr()
The correlation matrix is as follows:
As...
Change the font size
Change margin width
Change background colour