I am right now working on a database and I would like to go from XML to a Pandas DataFrame and I've been stuck for a long time now. I have no idea how to solve this problem.
j=0
for rows in root.findall('row'):
i=0
for cells in root.findall('cell') in rows:
if i==0:
#Name of the country is on the 0-th tag "cell" of each "row"
country[j]=cells.text
elif i==17:
#Number of students is on the 17-th tag "cell" of each "row"
numberStudent[j]=cells.text
i=i+1
j=j+1
Data=pd.DataFrame({'country': [country], 'number of student': [numberStudent]})
When I'm trying to read Data, there's only a dataframe with a value 0 for country and 0 for numberStudent. I don't understand what is wrong. I have been looking for answer already on this forum but I'm still stuck.
Also, I am not sure I am doing right. I would like to find the 0-th ans 17-th tag "cell" in each parent tag "row". Is it right to do use two times "in" in one declaration for the second for?