python - AttributeError: 'list' object has no attribute 'keys' when attempting to create DataFrame from list of dicts -


thanks ton help,

i have list of dictionaries need put in data frame. know normal method in pandas

final_df=pd.dataframe.from_records(mixed_and_poured[0], index='year') 

where mixed_and_poured list containing list holds dictionaries

print mixed_and_poured [[{'country': 'brazil', u'internet users': '2.9', 'year': '2000'}, {'country': 'brazil', u'internet users': '21', 'year': '2005'}, {'country': 'brazil', u'internet users': '40.7', 'year': '2010'}, {'country': 'brazil', u'internet users': '45', 'year': '2011'},  

i swear

final_df=pd.dataframe.from_records(mixed_and_poured[0], index='year') 

was working!! when ran today throws

attributeerror: 'list' object has no attribute 'keys' 

why looking keys in list now?

so turns out wasnt operating on list of dictionaries, there little bastard list hiding @ end there.

sorry ya'll!


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -