df saveto json

Solutions on MaxInterview for df saveto json by the best coders in the world

showing results for - "df saveto json"
Marta
13 May 2017
1>>> result = df.to_json(orient="index")
2>>> parsed = json.loads(result)
3>>> json.dumps(parsed, indent=4)  
4{
5    "row 1": {
6        "col 1": "a",
7        "col 2": "b"
8    },
9    "row 2": {
10        "col 1": "c",
11        "col 2": "d"
12    }
13}
14