Created
November 15, 2016 10:58
-
-
Save marketcalls/1d2ba65cb5ba1da38cf542947d2885bc to your computer and use it in GitHub Desktop.
Compute and Plot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Compute Percentage Change | |
rets = d.pct_change() | |
#Compute Correlation | |
corr = rets.corr() | |
#Plot Correlation Matrix using Matplotlib | |
%pylab inline | |
plt.figure(figsize=(10, 10)) | |
plt.imshow(corr, cmap='RdYlGn', interpolation='none', aspect='auto') | |
plt.colorbar() | |
plt.xticks(range(len(corr)), corr.columns, rotation='vertical') | |
plt.yticks(range(len(corr)), corr.columns); | |
plt.suptitle('Stock Correlations Heat Map', fontsize=15, fontweight='bold') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment