Skip to main content

decimate xml data while keeping others intact

Project description

Xml Subsetter

decimate data while keeping others intact

before

# bulk.xml
<r>
    <meta>
    some meta data
    </meta>

    <something>
    thing thing thing thing
    </something>

    <e>e0</e>
    <e>e1</e>
    <e>e2</e>
    <e>e3</e>
    <some-annoying-non-data-you-have-to-keep-1>ah yah yah</some-annoying-non-data-you-have-to-keep-1>
    <some-annoying-non-data-you-have-to-keep-2>ah yah yah</some-annoying-non-data-you-have-to-keep-2>
    <some-annoying-non-data-you-have-to-keep-3>ah yah yah</some-annoying-non-data-you-have-to-keep-3>
    <e>e4</e>
    <e>e5</e>
    <e>e6</e>
    <e>e7</e>
    <e>e8</e>
    <e>e9</e>
    <e>e10</e>
    ...
    <e>e99</e>
</r>

subset_head("bulk.xml", target_file='/tmp/small.xml', data_tag='e',ratio=0.05)

after

# small.xml
<r>
    <meta>
    some meta data
    </meta>

    <something>
    thing thing thing thing
    </something>

    <e>e0</e>
    <e>e1</e>
    <e>e2</e>
    <e>e3</e>
    <some-annoying-non-data-you-have-to-keep-1>ah yah yah</some-annoying-non-data-you-have-to-keep-1>
    <some-annoying-non-data-you-have-to-keep-2>ah yah yah</some-annoying-non-data-you-have-to-keep-2>
    <some-annoying-non-data-you-have-to-keep-3>ah yah yah</some-annoying-non-data-you-have-to-keep-3>
    <e>e4</e>
</r>

Project details


Download files

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

Files for xml-subsetter, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size xml-subsetter-0.0.2.tar.gz (4.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page