Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Read XML file to Pandas DataFrame

from lxml import objectify
xml = objectify.parse('Document1.xml')
root = xml.getroot()

data=[]
for i in range(len(root.getchildren())):
    data.append([child.text for child in root.getchildren()[i].getchildren()])

df = pd.DataFrame(data).T
df.columns = ['bathrooms', 'price', 'property_id']
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Read #XML #file #Pandas #DataFrame
ADD COMMENT
Topic
Name
4+6 =