Forum Discussion
Using FRED Data
Hi,
FRED (Federal Reserve Econcomic Data) is a great website that offers all kinds of economic series data free to the public, and I'm wondering if anyone can recommend a good connector to import these data series into BI.
Thank you in advance.
API can be tough. Basically, it's like getting from a web source. Check out these instructions: https://blogs.msdn.microsoft.com/charles_sterling/2016/05/25/how-to-call-rest-apis-and-parse-json-with-power-bi/
32 Replies
- Aron_MooreSolution Specialist
Looks like they have an API. https://research.stlouisfed.org/docs/api/fred/
- AnonymousNot applicable
I saw that. I know this is a very newbie question, but how do I use an API with PBI?
- Aron_MooreSolution Specialist
API can be tough. Basically, it's like getting from a web source. Check out these instructions: https://blogs.msdn.microsoft.com/charles_sterling/2016/05/25/how-to-call-rest-apis-and-parse-json-with-power-bi/
- powerbimeFrequent Visitor
These links are broken
Re: Using FRED Dataā04-09-2019 01:26 PMAPI can be tough. Basically, it's like getting from a web source. Check out these instructions: https://blogs.msdn.microsoft.com/charles_sterling/2016/05/25/how-to-call-rest-apis-and-parse-json-wi...
- AnonymousNot applicable
You can pull FRED data in with a Python script without an API if you have Python installed or you're comfortable installing it. Get Data/Python script then paste in code per this model:
import pandas_datareader.data as web import datetime # Choose start and end dates for the data series start = datetime.datetime(2015, 1, 1) end = datetime.datetime(2019, 10, 9) # Read the data: US Housing Starts HOUST FRED data set houst = web.DataReader('HOUST', 'fred', start, end) # Move the dates, which are row labels, to their own column houst.index.name = 'date' houst.reset_index(inplace=True)- wgillinghamNew Member
This worked perfect for me. Thanks for your help
- AnonymousNot applicable
I had been trying to get more than one economic indicator in power bi at the same time through their API so my friend and I created a python script to collect whatever number of series you want and appends them already making it really easy to slice when in power bi. I hope you guys enjoy this it took me a long time. It works with python 3.77 and make sure you have the modules requests, matplotlib and pandas. Oh and make sure you add your API token(key)
Enjoy and don't take credit for it.
#Modules
import urllib.request as urllib2
import urllib, json
import numpy as np
import pandas as pd#Static Variables
TOKEN = 'YourAPItoken'#initialzing array for tickers
tickers= []#open file and create one array of tickers IDs
tickers =['mspnhsus'
]#temporary variable store values from "for loop"
d = []#creating list of URL based on tickers list
for ticker in tickers:
tdata = '['
url = str(f'https://api.stlouisfed.org/fred/series/observations?series_id={ticker.strip()}&api_key={TOKEN}&file_type=json')#Opening web api and read JSON data
response = urllib2.urlopen(url)#create JSON object
json_obj = json.load(response)
for i in json_obj['observations']:
d.append({'ticker': ticker, 'date': i['date'], 'value': i['value']})#create variable "df" using format dataframe
df = pd.DataFrame(data=d)#print data ready to use for PowerBi
print(df)- rvernerFrequent Visitor
You are awesome!
- TylerChessmanNew Member
Hello All - I've built a custom connector for FRED (and the Energy Information Administration ā EIA). Would appreciate you trying it out - and providing feedback. Hopefully, this can be a built-in/certified connector one day. https://github.com/tylerchessman/PBI_FRED_EIA;
If you like what you see, make sure to vote for the feature at https://ideas.fabric.microsoft.com/ideas/idea/?ideaid=437ab693-4155-ed11-a76e-0003ff4534c2. For EIA data, please vote at https://ideas.fabric.microsoft.com/ideas/idea/?ideaid=18f4857d-5269-412e-b093-a036b52c3fa1