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.4.tar.gz
(2.3 kB
view details)
Built Distribution
File details
Details for the file xml_to_df-0.0.4.tar.gz
.
File metadata
- Download URL: xml_to_df-0.0.4.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1da3b4714671e5e0431441d62cd9cfae6469e12428622482dae0f90c35ab64f5 |
|
MD5 | 4e2603e4a8b8aab876e56642ae99c9fc |
|
BLAKE2b-256 | 9ee3282f8d39fd1f4e0390495d5ed72e9140b2fe8a68e20cb19c14de8216ed0a |
File details
Details for the file xml_to_df-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: xml_to_df-0.0.4-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10698fc9d6c8c0389bf0d205b18160c1c5dba59ec02e3bafe1135b7d79557d57 |
|
MD5 | a3d555f4390d820b91e7227006a6b11e |
|
BLAKE2b-256 | ff560e9a92e56986e46b80e39fe0b30a811a1168e3f5232dcb0591132593d9f8 |