【发布时间】:2019-02-12 00:54:54
【问题描述】:
我有一个这样的嵌套 json:
{
"Invalids":[
{
"Comments":"string",
"InputRequest":{
"LinesInfo":[
{
"LastPipeLineStateIds":[
0
],
"CropId":0
}
],
"Crop":"string",
"Year":"string"
}
},
{
"Comments":"string",
"InputRequest":{
"LinesInfo":[
{
"LastPipeLineStateIds":[
0
],
"CropId":0
}
],
"name":"string",
"number":"string"
}
}
],
"LinesResponse":{ },
"ErrorInfo":"string"
}
如果 'Invalids' 不为空,我想获得一个包含 'name' 和 'number' 的表。我正在这样做:
a = json_normalize(data['Invalid'])
但输出有前缀,如:'InputRequest.name',这是我不想要的。如何获得“姓名”和“号码”的干净列表(以“cmets”作为元数据)?
【问题讨论】:
标签: python json pandas normalize