In [2]:
%matplotlib inline
# import seaborn as sns # for plot styling
import matplotlib.pyplot as plt
from peaktrough import manhandle_freddata
In [4]:
fred_names = ["GDPC1", "PCECC96", "GPDIC96", "OPHNFB"]
func = lambda x: manhandle_freddata(x, figsize=(12, 6), saveshow="show")
gdpc1, pcecc96, gpdic96, ophnfb = map(func, fred_names)
In [7]:
## Below I tried calling map without a lhs. Seems to work fine.
map(func, fred_names)
print("done") # Just something so we don't see printout of all 5 DataFrames
In [8]:
load run_peaktrough.py
In [10]:
"""
Runs peaktrough.py, which generates Cooley-Rupert figures for specified
series from FRED.
Execute peaktrough.py first, then run this program.
Written by Dave Backus under the watchful eye of Chase Coleman and Spencer Lyon
Date: July 10, 2014
"""
from peaktrough import *
# one at a time
# manhandle_freddata("GDPC1", saveshow="save")
def kwarg_map(func, my_list, **kwargs):
f = lambda x: func(x, **kwargs)
return map(f, my_list)
# all at once with map -- needs lhs variables to run
# question: can we change the saveshow par inside map?
fred_series = ["GDPC1", "PCECC96", "GPDIC96", "OPHNFB"]
gdpc1, pcecc96, gpdic96, ophnfb = kwarg_map(manhandle_freddata, fred_series,
saveshow="show", figsize=(12, 6))
In [ ]: