root = ET.Element('intersections')
intersection = ET.SubElement(root, 'intersection')
trace = ET.SubElement(intersection, 'trace')
x = np.arange(6).reshape((2, 3))
s = io.BytesIO()
np.savetxt(s, x)
trace.text = s.getvalue()
print(ET.tostring(root, pretty_print=True, xml_declaration=True, encoding=
    'utf-8'))
Как экспортировать numpy ndarray в строковую переменную?