这里的目标是统计每种诊断类型的患者数量。在病历中,就诊id是唯一的,但在诊断记录中,由于一次就诊可能有多个诊断,因此同一就诊id可能有多个诊断id
为此,我认为需要将2数据框与实地访问id相链接。请任何人说明如何通过Pandas链接2 json,并计算每个诊断的患者数量。非常感谢
患者记录
JSON[病历]
[
{
"Doctor id":"AU1254",
"Patient":[
{
"Patient id":"BK1221",
"Patient name":"Tim"
}
],
"Visit id":"B0001"
},
{
"Doctor id":"AU8766",
"Patient":[
{
"Patient id":"BK1209",
"Patient name":"Sue"
}
],
"Visit id":"B0002"
},
{
"Doctor id":"AU1254",
"Patient":[
{
"Patient id":"BK1323",
"Patient name":"Sary"
}
],
"Visit id":"B0003"
}
]
诊断记录
JSON[诊断记录]
[
{
"Visit id":"B0001",
"Diagnosis":[
{
"diagnosis id":"D1001",
"diagnosis name":"fever"
},
{
"diagnosis id":"D1987",
"diagnosis name":"cough"
},
{
"diagnosis id":"D1265",
"diagnosis name":"running nose"
}
]
},
{
"Visit id":"B0002",
"Diagnosis":[
{
"diagnosis id":"D1987",
"diagnosis name":"cough"
},
{
"diagnosis id":"D1453",
"diagnosis name":"stomach ache"
}
]
}
]
请尝试以下方法查看患者记录
试试看:(
x
>;JSON [Patient record]
,y
>;JSON [Diagnosis record]
df\u合并:
计数:
编辑:
尝试:
您可以在
visit id
上使用左merge()
merge您还可以进行一些奇特的分组/打印
和每个诊断/每个患者的计数
相关问题 更多 >
编程相关推荐