Sitemap

FRED API and Python

Nov 11, 2021

--

Connecting to the Federal Reserve Datasets

#Install the FRED API

pip install fredapi

#Import panda

import pandas as pd

#Import matplotlib

import matplotlib.pyplot as plt

#Import FRED

from fredapi import Fred

#Add your FRED Private Key

Get John Smith LLM’s stories in your inbox

Join Medium for free to get updates from this writer.

fred=Fred(api_key=’abcdefghijklmnopqrstuvwxyz’)

#Load a Fred dataset (ex GDP)

data=fred.get_series(‘GDP’)

#To see the top 5 of the GDP dataset

data.head()

#To see the last 5 of the GDP dataset

data.tail()

#To get an observation for start and end

data = fred.get_series(‘GDP’, observation_start=’2019', observation_end = ‘2020’)

--

--

John Smith LLM
John Smith LLM

Written by John Smith LLM

Traveller, student of history with emphasis on the mechanics of oppression, law, and Information Security