I have a pandas dataframe with a single row. Now I need to
- Convert this dataframe into an xml string and store it to a variable
- Modify the xml string variable to add header tags.
- Load the modified xml string variable into azure data lake storage.
When I try to covert the dataframe to xml using 'to_xml()' function, I am not able to store this into a variable. Can anyone please help me with this?
I use azure synapse notebooks (python) to do this process.
Use the code below to convert a data frame into an XML string with a sample data frame:
This will convert the data frame to an XML string, as shown below:
To add header tags to the XML string, modify it using the following code:
The modified XML string is displayed as shown below: