I have XMl simulation output, with many vehicle lines like:
<routes>
<vehicle id="8643" type="car" depart="0.03" departLane="free" departSpeed="max" fromTaz="63" toTaz="5">
<vehicle id="8928" type="car" depart="0.34" departLane="free" departSpeed="max" fromTaz="663" toTaz="1147">
</routes>
Currently I have the below which prints the required attributes.
import xml.etree.cElementTree as ET
e = ET.parse('trip_049.rou.xml')
root = e.getroot()
for vehicle in root.findall('vehicle'):
id = vehicle.get('id')
origin = vehicle.get('fromTaz')
destination = vehicle.get('toTaz')
print id,origin,destination
Which outputs:
8643 63 5
8928 663 1147
But I need the loop output to be stored in a numpy array or equivalent like:
id origin destination
8643 63 5
8928 663 1147
Thank you in adavance