Convert Python dict into a dataframe

前端 未结 16 2567
暗喜
暗喜 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:06

    This is what worked for me, since I wanted to have a separate index column

    df = pd.DataFrame.from_dict(some_dict, orient="index").reset_index()
    df.columns = ['A', 'B']
    

提交回复
热议问题