Improve speed parsing XML with elements and namespace, into Pandas
问题 So I have a 52M xml file, which consists of 115139 elements. from lxml import etree tree = etree.parse(file) root = tree.getroot() In [76]: len(root) Out[76]: 115139 I have this function that iterates over the elements within root and inserts each parsed element inside a Pandas DataFrame. def fnc_parse_xml(file, columns): start = datetime.datetime.now() df = pd.DataFrame(columns=columns) tree = etree.parse(file) root = tree.getroot() xmlns = './/{' + root.nsmap[None] + '}' for loc,e in