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 24, 2020 in Python by Rakesh
• 120 points
706 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

I have trained a model using machine learning algorithm in python , now i want to create a browser extension of that saved model , Is it possible ??

Hi@Shubham, It may possible. When you saved your ML ...READ MORE

answered Jun 13, 2020 in Python by MD
• 95,460 points
1,146 views
0 votes
1 answer

what is vm options ? I installed Pycharm on my pc but it shows no vm options file found . What should i do please help me to fix it

Hi, @Mushfiqkhantrial, It is important to run pycharm.sh from the bin folder. The VM ...READ MORE

answered Oct 4, 2020 in Python by Gitika
• 65,770 points
1,869 views
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,300 points
3,264 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
2,465 views
+1 vote
1 answer
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
626 views
0 votes
2 answers
+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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,468 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP