具有嵌套标记结构的XML到Python数据框架

具有嵌套标记结构的XML到Python数据框架,python,xml,dataframe,Python,Xml,Dataframe,我在结构中有一个巨大的XML,如下图所示。我需要将其解析为一个数据帧。我的数据框将包含诸如FinInstrmGnlAttrbts\u ID,FinInstrmGnlAttrbts\u FullName等列。 我不知道如何在Python中遍历XML标记结构 import xml.etree.ElementTree as et _xt = et.parse("DLTINS_20171019_01of01.xml") _xr = _xt.getroot() _xr for child in _xr:

我在结构中有一个巨大的XML,如下图所示。我需要将其解析为一个数据帧。我的数据框将包含诸如
FinInstrmGnlAttrbts\u ID
FinInstrmGnlAttrbts\u FullName
等列。 我不知道如何在Python中遍历XML标记结构

import xml.etree.ElementTree as et
_xt = et.parse("DLTINS_20171019_01of01.xml")
_xr = _xt.getroot()
_xr
for child in _xr:
    print (child.tag, child.attrib)
它给了我

{urn:iso:std:iso:20022:tech:xsd:head.003.001.01}Hdr {}
{urn:iso:std:iso:20022:tech:xsd:head.003.001.01}Pyld {}

哦,不!“如果一个女孩给了你一个正确的答案怎么办?”费利徐先生,那么我会对她说,谢谢格兰德梅小姐。”您可以尝试使用其他方法来“展平”XML。搜索“扁平化XML Python”以查找更多内容。您确实会得到一些输出。有什么问题吗?