Skip to main content

Explode list/tuples in columns

pip install a-pandas-ex-horizontal-explode
from a_pandas_ex_horizontal_explode import pd_add_horizontal_explode

pd_add_horizontal_explode()

import pandas as pd

df = pd.Series(

    [

        ("enabled_previews_v1", "type", 0),

        ("enabled_previews_v1", "version", 0),

        True,

        ("enabled_previews_v1", "type", 0),

        ("enabled_previews_v1", 0),

        ("locale", 0),

        ("properties", "property_key", 0),

        ("properties", "property_value", 0),

        ("properties",),

        ("resume", "package_name", 0),

        ("resume", "stack", 0),

        ("resume", "timestamp", 0),

        ("resume", "external", 0),

        ("android_metadata", "locale", 0),

        ("android_metadata", "locale", 0),

        ("android_metadata", "locale", 0),

        33,

        ("_sync_state", "_id", 0),

    ]

)

df2 = df.to_frame()

df2.columns=['aa']



dfex = df.ds_horizontal_explode(concat=True)

print(dfex.to_string())



dfex2 = df2.ds_horizontal_explode('aa',concat=False)

print(dfex2.to_string())





                                    0                  0_0             0_1   0_2

0      (enabled_previews_v1, type, 0)  enabled_previews_v1            type     0

1   (enabled_previews_v1, version, 0)  enabled_previews_v1         version     0

2                                True                 <NA>            <NA>  <NA>

3      (enabled_previews_v1, type, 0)  enabled_previews_v1            type     0

4            (enabled_previews_v1, 0)  enabled_previews_v1               0  <NA>

5                         (locale, 0)               locale               0  <NA>

6       (properties, property_key, 0)           properties    property_key     0

7     (properties, property_value, 0)           properties  property_value     0

8                       (properties,)           properties            <NA>  <NA>

9           (resume, package_name, 0)               resume    package_name     0

10                 (resume, stack, 0)               resume           stack     0

11             (resume, timestamp, 0)               resume       timestamp     0

12              (resume, external, 0)               resume        external     0

13      (android_metadata, locale, 0)     android_metadata          locale     0

14      (android_metadata, locale, 0)     android_metadata          locale     0

15      (android_metadata, locale, 0)     android_metadata          locale     0

16                                 33                 <NA>            <NA>  <NA>

17              (_sync_state, _id, 0)          _sync_state             _id     0

                   aa_0            aa_1  aa_2

0   enabled_previews_v1            type     0

1   enabled_previews_v1         version     0

2                  <NA>            <NA>  <NA>

3   enabled_previews_v1            type     0

4   enabled_previews_v1               0  <NA>

5                locale               0  <NA>

6            properties    property_key     0

7            properties  property_value     0

8            properties            <NA>  <NA>

9                resume    package_name     0

10               resume           stack     0

11               resume       timestamp     0

12               resume        external     0

13     android_metadata          locale     0

14     android_metadata          locale     0

15     android_metadata          locale     0

16                 <NA>            <NA>  <NA>

17          _sync_state             _id     0

Metadata

Release files for a-pandas-ex-horizontal-explode 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for a-pandas-ex-horizontal-explode 0.10
File Size Uploaded Provenance Actions
a_pandas_ex_horizontal_explode-0.10.tar.gz 4.4 kB Without provenance Details for a_pandas_ex_horizontal_explode-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for a-pandas-ex-horizontal-explode 0.10
File Interpreter ABI Platform Actions
a_pandas_ex_horizontal_explode-0.10-py3-none-any.whl Python 3 none any Details for a_pandas_ex_horizontal_explode-0.10-py3-none-any.whl

Total release size: 10.5 kB

Release files / a_pandas_ex_horizontal_explode-0.10.tar.gz

Download URL a_pandas_ex_horizontal_explode-0.10.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
61bf54dbd8a796e293e9abed1350a5c80efd83f609110d325c541022c1b99dae
BLAKE2b-256 checksum
How to use checksums
092f5b1533c685d21d968cd7fa96d1fe6e2d4d4ad92ed86b9ecc285ee5446f7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / a_pandas_ex_horizontal_explode-0.10-py3-none-any.whl

Download URL a_pandas_ex_horizontal_explode-0.10-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19d4eb122b765dcdb47cba375f2b95e7cfe174145891aca3b8678a020e1d2933
BLAKE2b-256 checksum
How to use checksums
adab748aa645a5687ad69ec5f5c473c65ef48053c764f8a01885f5d08ee3fe0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for a-pandas-ex-horizontal-explode 0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page