I have a dataframe as below
df = pd.DataFrame({'Field':['FAPERF','FAPERF','FAPERF','FAPERF'],
           'Form':['LIVERID','LIVERID','LIVERID','LIVERID'],
           'Folder':['ALL','ALL','ALL','ALL'],
           'Logline':['9','9','9','10'],
           'Data':['Yes','Blank','No','Yes']})
I have to invoke these values to a xml files in the format as below
<?xml version="1.0" encoding="UTF-8"?>
<ODM xmlns="http://www.cdisc.org/ns/odm/v1.3" xmlns:mdsol="http://www.mdsol.com/ns/odm/metadata"
     ODMVersion="1.3" CreationDateTime="2019-10-25T07:29:41.711-00:00"
     FileOID="9a49b521-41ca-4b4b-81f1-9eae73df1c99" FileType="Transactional">
    <ClinicalData StudyOID="D933LC00001(DEV)" MetaDataVersionOID="1">
        <SubjectData SubjectKey="E888017" TransactionType="Update">
            <SiteRef LocationOID="9999 - A Site"/>
            <StudyEventData StudyEventOID="VISIT1" TransactionType="Update">
                <FormData FormOID="DM" TransactionType="Update">
                    <ItemGroupData ItemGroupOID="DM" TransactionType="Upsert">
                        <ItemData ItemOID="SEX" Value="C16576" TransactionType="Context">
                            <mdsol:Query Recipient="Site" Value="Analyse the race value"
                                         Status="Open"/>
                        </ItemData>
                    </ItemGroupData>
                </FormData>
            </StudyEventData>
        </SubjectData>
    </ClinicalData>
</ODM>
The code i have written so far is below
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
import datetime
import openpyxl, smtplib, sys
#from ElementTree import prettify
generated_on = str(datetime.datetime.now())
root = Element('ODM')
root.set('version', '1.0')
#def alldata(Form, Logline, Data, Field, Folder): 
for i in length (final_intermediate1):   
    SubjectData=SubElement(ClinicalData, 'SubjectData', {'text':Form(i)})
    SiteRef =SubElement(SubjectData, 'SiteRef', {'text':Logline(i)})
    StudyEventData =SubElement(SiteRef, 'StudyEventData', {'text':Data(i)})
    FormData =SubElement(StudyEventData, 'FormData', {'text':Field(i)})
    ItemGroupData =SubElement(FormData, 'ItemGroupData', {'text':Folder(i)})
    #ClinicalData=SubElement(root, 'ClinicalData')
print prettify(root)
Not sure how to unpack the values form dataframe and invoke them to xml. I am stuck over here. Any help please
 
     
    