Created
          March 17, 2017 19:13 
        
      - 
      
- 
        Save trcook/7c77e69299679a72d779e5841ddd202e to your computer and use it in GitHub Desktop. 
    random scrap to get and plot series from fred
  
        
  
    
      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
    
  
  
    
  | import fredapi as fred | |
| import pandas | |
| import matplotlib.pyplot as plt | |
| apikey=open("/Users/j1trc01/.fred_api_key",'r').read() | |
| Fred=fred.Fred(apikey) | |
| gdpnow=Fred.get_series("GDPNOW") | |
| gdp=Fred.get_series("A191RL1Q225SBEA") | |
| dat=pd.DataFrame({'gdpnow':gdpnow,'gdp':gdp}) | |
| dat['error']=abs(dat['gdpnow']-dat['gdp']) | |
| plt.plot(dat.error,c='r') | |
| plt.show() | |
| msk=dat.gdpnow.isnull()==False | |
| plt.plot(dat.gdp[msk],label='gdp') | |
| plt.plot(dat.gdpnow[msk],label='gdpnow') | |
| plt.legend() | |
| plt.show() | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment