Skip to main content

Package to convert xml to Pandas dataframe (flattens each and every xml element to dataframe column)

Project description

XML to Pandas Dataframe

Flattens out nested xml to individual columns in dataframe

Sample input.xml
<bookstore>
<book category="COOKING">
    <title lang="en">Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.00</price>
  </book>
  <book category="CHILDREN">
    <title lang="en" language="hello">Harry Potter</title>
    <author>J K. Rowling</author>
    <cricketers>
        <cricketer1>Praveen</cricketer1>
        <cricketer2>Pathan</cricketer2>
        <country>india</country>
        <country>india1</country>
      </cricketers>
    <year>2005</year>
    <price>29.99</price>
  </book>
  <book category="WEB">
    <title lang="en">Learning XML</title>
    <author>Erik T. Ray</author>
    <year>2003</year>
    <price>39.95</price>
  </book>
</bookstore>

df = xml_to_df.convert_xml_to_df("input.xml")

df.head()

Output dataframe
category lang title author year price language cricketer1 cricketer2 country
COOKING en Everyday Italian Giada De Laurentiis 2005 30.00 NaN NaN NaN NaN
CHILDREN en Harry Potter J K. Rowling 2005 29.99 hello Praveen Pathan [india, india1]
WEB en Learning XML Erik T. Ray 2003 39.95 NaN NaN NaN NaN

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xml_to_df-0.0.5.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

xml_to_df-0.0.5-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file xml_to_df-0.0.5.tar.gz.

File metadata

  • Download URL: xml_to_df-0.0.5.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for xml_to_df-0.0.5.tar.gz
Algorithm Hash digest
SHA256 9f07279beefb144dd5f1c84e440ec067df14be2d4588a62614076011357edb1c
MD5 7419a06eabecef5c952ea921240ed51e
BLAKE2b-256 2b5c6b7e4d2ff319aec7e676158a60110fff382e6bddce78f4f06d709ddb6be9

See more details on using hashes here.

File details

Details for the file xml_to_df-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: xml_to_df-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for xml_to_df-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7a666580306e0112e6bcd9991a5820a52e485f9deac438daa4d43fb9e0f582aa
MD5 bf8d992afd6931bf9cb7253eb85101c2
BLAKE2b-256 7817aedf04a4f42a2111bf1850b668e838ac5311b9a2f3df2439fe0f0a0ba58e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page