a-pandas-ex-horizontal-explode


Namea-pandas-ex-horizontal-explode JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/a_pandas_ex_horizontal_explode
SummaryExplode list/tuples in columns
upload_time2022-12-05 23:53:53
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords explode pandas dataframe series
VCS
bugtrack_url
requirements pandas
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Explode list/tuples in columns 



```python

pip install a-pandas-ex-horizontal-explode

```



```python

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



```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/a_pandas_ex_horizontal_explode",
    "name": "a-pandas-ex-horizontal-explode",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Explode,pandas,DataFrame,Series",
    "author": "Johannes Fischer",
    "author_email": "<aulasparticularesdealemaosp@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/09/2f/5b1533c685d21d968cd7fa96d1fe6e2d4d4ad92ed86b9ecc285ee5446f7f/a_pandas_ex_horizontal_explode-0.10.tar.gz",
    "platform": null,
    "description": "\n# Explode list/tuples in columns \n\n\n\n```python\n\npip install a-pandas-ex-horizontal-explode\n\n```\n\n\n\n```python\n\nfrom a_pandas_ex_horizontal_explode import pd_add_horizontal_explode\n\npd_add_horizontal_explode()\n\nimport pandas as pd\n\ndf = pd.Series(\n\n    [\n\n        (\"enabled_previews_v1\", \"type\", 0),\n\n        (\"enabled_previews_v1\", \"version\", 0),\n\n        True,\n\n        (\"enabled_previews_v1\", \"type\", 0),\n\n        (\"enabled_previews_v1\", 0),\n\n        (\"locale\", 0),\n\n        (\"properties\", \"property_key\", 0),\n\n        (\"properties\", \"property_value\", 0),\n\n        (\"properties\",),\n\n        (\"resume\", \"package_name\", 0),\n\n        (\"resume\", \"stack\", 0),\n\n        (\"resume\", \"timestamp\", 0),\n\n        (\"resume\", \"external\", 0),\n\n        (\"android_metadata\", \"locale\", 0),\n\n        (\"android_metadata\", \"locale\", 0),\n\n        (\"android_metadata\", \"locale\", 0),\n\n        33,\n\n        (\"_sync_state\", \"_id\", 0),\n\n    ]\n\n)\n\ndf2 = df.to_frame()\n\ndf2.columns=['aa']\n\n\n\ndfex = df.ds_horizontal_explode(concat=True)\n\nprint(dfex.to_string())\n\n\n\ndfex2 = df2.ds_horizontal_explode('aa',concat=False)\n\nprint(dfex2.to_string())\n\n\n\n\n\n                                    0                  0_0             0_1   0_2\n\n0      (enabled_previews_v1, type, 0)  enabled_previews_v1            type     0\n\n1   (enabled_previews_v1, version, 0)  enabled_previews_v1         version     0\n\n2                                True                 <NA>            <NA>  <NA>\n\n3      (enabled_previews_v1, type, 0)  enabled_previews_v1            type     0\n\n4            (enabled_previews_v1, 0)  enabled_previews_v1               0  <NA>\n\n5                         (locale, 0)               locale               0  <NA>\n\n6       (properties, property_key, 0)           properties    property_key     0\n\n7     (properties, property_value, 0)           properties  property_value     0\n\n8                       (properties,)           properties            <NA>  <NA>\n\n9           (resume, package_name, 0)               resume    package_name     0\n\n10                 (resume, stack, 0)               resume           stack     0\n\n11             (resume, timestamp, 0)               resume       timestamp     0\n\n12              (resume, external, 0)               resume        external     0\n\n13      (android_metadata, locale, 0)     android_metadata          locale     0\n\n14      (android_metadata, locale, 0)     android_metadata          locale     0\n\n15      (android_metadata, locale, 0)     android_metadata          locale     0\n\n16                                 33                 <NA>            <NA>  <NA>\n\n17              (_sync_state, _id, 0)          _sync_state             _id     0\n\n                   aa_0            aa_1  aa_2\n\n0   enabled_previews_v1            type     0\n\n1   enabled_previews_v1         version     0\n\n2                  <NA>            <NA>  <NA>\n\n3   enabled_previews_v1            type     0\n\n4   enabled_previews_v1               0  <NA>\n\n5                locale               0  <NA>\n\n6            properties    property_key     0\n\n7            properties  property_value     0\n\n8            properties            <NA>  <NA>\n\n9                resume    package_name     0\n\n10               resume           stack     0\n\n11               resume       timestamp     0\n\n12               resume        external     0\n\n13     android_metadata          locale     0\n\n14     android_metadata          locale     0\n\n15     android_metadata          locale     0\n\n16                 <NA>            <NA>  <NA>\n\n17          _sync_state             _id     0\n\n\n\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Explode list/tuples in columns",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/a_pandas_ex_horizontal_explode"
    },
    "split_keywords": [
        "explode",
        "pandas",
        "dataframe",
        "series"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "adab748aa645a5687ad69ec5f5c473c65ef48053c764f8a01885f5d08ee3fe0c",
                "md5": "5a62e125543ec297f80bc22b209d4226",
                "sha256": "19d4eb122b765dcdb47cba375f2b95e7cfe174145891aca3b8678a020e1d2933"
            },
            "downloads": -1,
            "filename": "a_pandas_ex_horizontal_explode-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5a62e125543ec297f80bc22b209d4226",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6113,
            "upload_time": "2022-12-05T23:53:51",
            "upload_time_iso_8601": "2022-12-05T23:53:51.368351Z",
            "url": "https://files.pythonhosted.org/packages/ad/ab/748aa645a5687ad69ec5f5c473c65ef48053c764f8a01885f5d08ee3fe0c/a_pandas_ex_horizontal_explode-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "092f5b1533c685d21d968cd7fa96d1fe6e2d4d4ad92ed86b9ecc285ee5446f7f",
                "md5": "b825565b91d7595040cff4468fbd45c0",
                "sha256": "61bf54dbd8a796e293e9abed1350a5c80efd83f609110d325c541022c1b99dae"
            },
            "downloads": -1,
            "filename": "a_pandas_ex_horizontal_explode-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "b825565b91d7595040cff4468fbd45c0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4365,
            "upload_time": "2022-12-05T23:53:53",
            "upload_time_iso_8601": "2022-12-05T23:53:53.338357Z",
            "url": "https://files.pythonhosted.org/packages/09/2f/5b1533c685d21d968cd7fa96d1fe6e2d4d4ad92ed86b9ecc285ee5446f7f/a_pandas_ex_horizontal_explode-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-05 23:53:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "a_pandas_ex_horizontal_explode",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "pandas",
            "specs": []
        }
    ],
    "lcname": "a-pandas-ex-horizontal-explode"
}
        
Elapsed time: 0.46410s