Convert Python dict into a dataframe

前端 未结 16 2372
暗喜
暗喜 2020-11-22 03:18

I have a Python dictionary like the following:

{u\'2012-06-08\': 388,
 u\'2012-06-09\': 388,
 u\'2012-06-10\': 388,
 u\'2012-06-11\': 389,
 u\'2012-06-12\':          


        
16条回答
  •  伪装坚强ぢ
    2020-11-22 04:00

    This is how it worked for me :

    df= pd.DataFrame([d.keys(), d.values()]).T
    df.columns= ['keys', 'values']  # call them whatever you like
    

    I hope this helps

提交回复
热议问题