Convert Pandas DataFrame to JSON format

前端 未结 7 1735
野性不改
野性不改 2020-11-30 01:45

I have a Pandas DataFrame with two columns – one with the filename and one with the hour in which it was generated:

 File       Hour
  F1               


        
7条回答
  •  情话喂你
    2020-11-30 02:13

    instead of using dataframe.to_json(orient = “records”) use dataframe.to_json(orient = “index”) my above code convert the dataframe into json format of dict like {index -> {column -> value}}

提交回复
热议问题