I have a Pandas DataFrame with two columns – one with the filename and one with the hour in which it was generated:
DataFrame
File Hour F1
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}}
dataframe.to_json(orient = “records”)
dataframe.to_json(orient = “index”)