Pandas版本:0.19.2
系統版本:Windows 10
import pandas as pd
dic1 = {'name':'dondon','number':1,'hobby':'carnivorous plant'}
dic2 = {'name':'Jay','number':2,'hobby':'singing'}
list1 = [dic1,dic2]
df_collect = pd.DataFrame()
df_temp = pd.DataFrame()
for dic_temp in list1:
for key in dic_temp.keys():
df_temp[key]=[dic_temp[key]]
df_collect = df_collect.append(df_temp, ignore_index=True)
df_collect
執行結果:
沒有留言:
張貼留言