Convert an XML File to CSV with Python - Supports Nested XML

Sdílet
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

Komentáře • 4

  • @user-zr5ke7np8u
    @user-zr5ke7np8u Před 20 dny

    Thanks, helped me a lot !

  • @user-lq7vi4hm4s
    @user-lq7vi4hm4s Před 4 měsíci +1

    very useful, thanks

  • @nicolailysa6829
    @nicolailysa6829 Před 5 měsíci +1

    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? :)

    • @syntaxbyte
      @syntaxbyte  Před 5 měsíci

      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.