【发布时间】:2018-03-19 06:25:39
【问题描述】:
使用本题的数据集(Pandas dataframe to json without index),如何添加数据框的名称?
to_json() 回复我这个:
[
{"id":0,"location":"[50, 50]"},
{"id":1,"location":"[60, 60]"},
{"id":2,"location":"[70, 70]"},
{"id":3,"location":"[80, 80]"}
]
但我想要这样的 JSON:
{
"stops":
[
{"id":0,"location":"[50, 50]"},
{"id":1,"location":"[60, 60]"},
{"id":2,"location":"[70, 70]"},
{"id":3,"location":"[80, 80]"}
]
}
【问题讨论】:
标签: python json pandas dataframe