Convert list of dictionaries to a pandas DataFrame

前端 未结 7 2193
清酒与你
清酒与你 2020-11-22 01:22

I have a list of dictionaries like this:

[{\'points\': 50, \'time\': \'5:00\', \'year\': 2010}, 
{\'points\': 25, \'time\': \'6:00\', \'month\': \"february\"         


        
7条回答
  •  爱一瞬间的悲伤
    2020-11-22 01:41

    The easiest way I have found to do it is like this:

    dict_count = len(dict_list)
    df = pd.DataFrame(dict_list[0], index=[0])
    for i in range(1,dict_count-1):
        df = df.append(dict_list[i], ignore_index=True)
    

提交回复
热议问题