Convert an XML File to CSV with Python - Supports Nested XML
Vložit
- čas přidán 7. 07. 2024
- In this video, I show you how to use Python and pandas to convert an XML file to CSV. Nested XML is also supported by using a stylesheet to adjust the file to a two-dimensional structure.
Source code: syntaxbytetutorials.com/impor...
Helpful links:
XPath: www.w3schools.com/xml/xpath_s...
XSLT: www.w3schools.com/xml/xsl_int... - Věda a technologie
Thanks, helped me a lot !
very useful, thanks
Thanks, very helpful video! How would this be affected by say, multiple addresses in the same on the same user? Would it be possible to create a stylesheet for a dynamic amount of addresses on each user? :)
Yes, you should be able to use the stylesheet to deal with that using a for-each. Unfortunately that's not a format that converts very well to a table. You either have to have a fixed number of addresses in the table each with their own column(s) and nulls for accounts that don't have that many addresses, or a single address column and multiple entries for any account with more than 1 address.