i want to create a dataframe,everytime i am gonna parse a xml file ,my expectation is all AIN.MFN and REG should come d contain all of themfrom that file but it is returning a dataframe with one row

0 votes
from xml.dom import minidom
import pandas as pd
mydoc = minidom.parse(path)
item1 = mydoc.getElementsByTagName("AIN")
item2=mydoc.getElementsByTagName("REG")
item3=mydoc.getElementsByTagName("MFN")
    

columns = ["AIN", "REG", "MFN"]

datatframe = pd.DataFrame(columns = columns)

for elem1,elem2,elem3 in zip(item1,item2,item3):

    AIN =  elem1.firstChild.data

    REG = elem2.firstChild.data

    MFN = elem3.firstChild.data

    dataframe = datatframe.append(pd.Series([AIN, REG, MFN], index = columns), ignore_index = True)
    dataframe.to_csv('SQ190820_2.csv')
Feb 23 in Python by Rakesh
• 120 points
134 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer
0 votes
1 answer

Is it enough to only create checksum of a zip package instead of each file?

I assume you are asking about the ...READ MORE

answered May 8, 2019 in Python by SDeb
• 13,250 points
179 views
0 votes
0 answers
+2 votes
0 answers

I am trying to create mininet, but I cannot ping all host and switch

I am trying to do mininet environment ...READ MORE

Aug 4, 2019 in Python by Jiun-Jung
• 140 points
289 views
+1 vote
1 answer
0 votes
0 answers

I am trying to click the button but it is not working and it is drop list ..

<a class="quickreports btn btn3d tbbtn" href="javascript:" style="position:static" ...READ MORE

Dec 1, 2019 in Python by anonymous
• 120 points
141 views
0 votes
0 answers

how do i perform XML parsing in python?

can you give me the python code ...READ MORE

Apr 10, 2019 in Python by Waseem
• 4,540 points
72 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,186 views