[Tutor] getting and using information dict objects

Matthew Johnson mcooganj at gmail.com
Sat Feb 23 22:56:58 CET 2013


I am trying to make a move from excel to python. My main need is
economic data -- to do economic analysis.

I have found the FRED package, and appear to have connected to the St
Louis Fed's FRED and downloaded some data, but i'm not sure what to do
with the objects that are returned.


> import fred

> fred.key(fredKey)

(i guessed that i should not provide my own FRED API key)

> gnp = fred.series('GNPCA')

i can see that the object returned is a dict

> type(gnp)

<type 'dict'>

but i cannot see how to access the observations, or use them in any way.

After a bit of fiddling about, i managed to find another method, which
i think also returns a dictionary of values and meta-data:

gnpObvs = fred.observations('GNPCA')

however I cannot figure out how to get the observation values out and
use them.

I may be thinking in the wrong framework -- i guess i'm expecting
something that is an intuitive as an excel table.

The end game for me is making plots of variables, combining them, and
doing regressions -- i cannot see how i might take what i'm getting
from these FRED / Python dicts to actual data analysis.

Could someone please help me take these first steps?

thanks + best regards


More information about the Tutor mailing list