You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was just looking at this over the weekend. Doing something similar to how multiple yahoo symbols are handled I came up with:
defget_data_fred2(name=None, start=dt.datetime(2010, 1, 1),
end=dt.datetime.today()):
""" Get data for the given name from the St. Louis FED (FRED). Date format is datetime Returns a DataFrame. """lst= []
name=list(name)
forninname:
start, end=_sanitize_dates(start, end)
if(nisNone):
print"Need to provide a name"returnNonefred_URL="http://research.stlouisfed.org/fred2/series/"url=fred_URL+'%s'%n+ \
'/downloaddata/%s'%n+'.csv'data=read_csv(urllib.urlopen(url), index_col=0, parse_dates=True,
header=None, skiprows=1, names=["DATE", n])
lst.append(data.truncate(start, end))
returnconcat(lst, axis=1, join='outer')
I haven't had any time to clean it up and make it more robust. It has zero exception handling, but as long as all of the series passed are valid it should work.
I haven't looked under the hood yet, but it doesn't look like you can grab multiple series from FRED data at the moment. This works
but this just hangs and then returns an empty DataFrame
The text was updated successfully, but these errors were encountered: