我想将以下python字典转换为pandas DataFrame:
people = {
"name": nameList,
"birth_date": birthDateList,
"birth_location": birthLocList,
"marriage_date": marriageDateList,
"marriage_location": marriageLocList,
"coordinates": coords,
"GEDCOM_ID": gedcomIDList
}
where marriageDateList
and marriageLocList
are lists of lists (since any given individual can be married more than once).
我想以某种方式将这些额外的结婚日期/地点转换为各自的列,例如“第一婚姻日期”,“第一婚姻位置”,“第二婚姻日期”,“第二婚姻位置”等。
注意:我不会事先知道我需要多少个婚姻栏,因为这会随数据集而变化。因此,一个人可能有4个婚姻,因此只有“第4个婚姻”列中的条目。
任何有关如何最好地做到这一点的意见将不胜感激。