I\'m trying to take a dataframe and transform it into a partcular json format.
Here\'s my dataframe example:
DataFrame name: Stops
id location
0
If you want a Python dict (the JSON-object equivalent in python) not a JSON string:
df.to_dict(orient='records')
You can use orient='records'
print df.reset_index().to_json(orient='records')
[
{"id":0,"location":"[50, 50]"},
{"id":1,"location":"[60, 60]"},
{"id":2,"location":"[70, 70]"},
{"id":3,"location":"[80, 80]"}
]