[Tutor] getting and using information dict objects
msirenef at lightbird.net
Sat Feb 23 23:28:19 CET 2013
On 02/23/2013 04:56 PM, Matthew Johnson wrote:
> 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
> (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 '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
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
Basic use of dictionaries is:
d = dict(x=1, y=2)
for key, val in d.items():
Lark's Tongue Guide to Python: http://lightbird.net/larks/
More information about the Tutor