i have 2 set of files - (1) CSV file (the main file) (2) XML file.
CSV file -
emp_id
1
2
3
4
XML File -
<employee>
<emp id="1" />
<emp id="2" active="yes">
<tag k="age" v="55" />
</emp>
<emp id="3" active="yes">
<tag k="name" v="scott" />
</emp>
<emp id="4" active="no">
<tag k="address" v="Texas" />
</emp>
<emp id="5" gender="male"/>
<emp id="8" />
<emp id="9" />
<emp id="10" />
<emp id="11" />
</employee>
My objective is have a csv file where the emp_id from the csv file is matched with the XML file, and only the matched emp_id is created in the new csv file. I need 2 csv files like below -
1st file.
emp_id,active,gender
1,,
2,yes,
3,yes,
4,no,
5,,male
2nd file.
emp_id,key,value
2,age,55
3,name,scott
4,address,Texas
I can read the CSV file in pandas, and XML file in Python. But don't know how to combine them and extract keys and value from the XML
Any help is appreciated.
