# Pairwise explode columns in a pandas DataFrame
```python
# Tested with:
# Python 3.9.13
# Windows 10
pip install a-pandas-ex-pairwise-explode
from a_pandas_ex_pairwise_explode import pd_add_pairwise_explode
import pandas as pd
pd_add_pairwise_explode()
df = pd.DataFrame(
[
((244, 22, 12), (1, 3, 4), "a"),
((2424, 221), (1, 3), "b"),
((26544, 22, 12, "1"), (1, 3, 4, "dd"), "c"),
((244, 22, 12), (1, 3, 4), "d"),
]
)
"""
0 1 2
0 (244, 22, 12) (1, 3, 4) a
1 (2424, 221) (1, 3) b
2 (26544, 22, 12, 1) (1, 3, 4, dd) c
3 (244, 22, 12) (1, 3, 4) d
"""
dfnew = df.d_pairwise_explode(columns=[0, 1])
"""
0 1 2
0 244 1 a
0 22 3 a
0 12 4 a
1 2424 1 b
1 221 3 b
2 26544 1 c
2 22 3 c
2 12 4 c
2 1 dd c
3 244 1 d
3 22 3 d
3 12 4 d
"""
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/a_pandas_ex_pairwise_explode",
"name": "a-pandas-ex-pairwise-explode",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "pandas,explode",
"author": "Johannes Fischer",
"author_email": "<aulasparticularesdealemaosp@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/63/f7/2f7da9e9d1ef7266d06301d9af65434eefdb837de10086b4d2064b11a3f0/a_pandas_ex_pairwise_explode-0.10.tar.gz",
"platform": null,
"description": "\n# Pairwise explode columns in a pandas DataFrame\n\n```python\n# Tested with:\n# Python 3.9.13\n# Windows 10\n\npip install a-pandas-ex-pairwise-explode\n\n\n\nfrom a_pandas_ex_pairwise_explode import pd_add_pairwise_explode\nimport pandas as pd\npd_add_pairwise_explode()\ndf = pd.DataFrame(\n [\n ((244, 22, 12), (1, 3, 4), \"a\"),\n ((2424, 221), (1, 3), \"b\"),\n ((26544, 22, 12, \"1\"), (1, 3, 4, \"dd\"), \"c\"),\n ((244, 22, 12), (1, 3, 4), \"d\"),\n ]\n)\n\"\"\"\n 0 1 2\n0 (244, 22, 12) (1, 3, 4) a\n1 (2424, 221) (1, 3) b\n2 (26544, 22, 12, 1) (1, 3, 4, dd) c\n3 (244, 22, 12) (1, 3, 4) d\n\n\"\"\"\n\ndfnew = df.d_pairwise_explode(columns=[0, 1])\n\"\"\"\n 0 1 2\n0 244 1 a\n0 22 3 a\n0 12 4 a\n1 2424 1 b\n1 221 3 b\n2 26544 1 c\n2 22 3 c\n2 12 4 c\n2 1 dd c\n3 244 1 d\n3 22 3 d\n3 12 4 d\n\"\"\"\n\n\n\n```\n\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Pairwise explode columns in a pandas DataFrame",
"version": "0.10",
"split_keywords": [
"pandas",
"explode"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a0471f4ee059a4fc8c1f7a3783343a361562a7f771837e3802ca247ed72b1efc",
"md5": "3c5f7d5a9a790699db50ee2de989680e",
"sha256": "3051ad43c181eb65f4621f28e0883ca91ac1086256c668626e6d5168047b4fe8"
},
"downloads": -1,
"filename": "a_pandas_ex_pairwise_explode-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3c5f7d5a9a790699db50ee2de989680e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5084,
"upload_time": "2023-01-06T02:59:30",
"upload_time_iso_8601": "2023-01-06T02:59:30.210178Z",
"url": "https://files.pythonhosted.org/packages/a0/47/1f4ee059a4fc8c1f7a3783343a361562a7f771837e3802ca247ed72b1efc/a_pandas_ex_pairwise_explode-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "63f72f7da9e9d1ef7266d06301d9af65434eefdb837de10086b4d2064b11a3f0",
"md5": "cc9e2d2051f275845de200804ba8fe4d",
"sha256": "7c21b2101ad875b70ddf53fba5afd4c6084f35614ce8582f7880a337e4b3c090"
},
"downloads": -1,
"filename": "a_pandas_ex_pairwise_explode-0.10.tar.gz",
"has_sig": false,
"md5_digest": "cc9e2d2051f275845de200804ba8fe4d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3531,
"upload_time": "2023-01-06T02:59:31",
"upload_time_iso_8601": "2023-01-06T02:59:31.641505Z",
"url": "https://files.pythonhosted.org/packages/63/f7/2f7da9e9d1ef7266d06301d9af65434eefdb837de10086b4d2064b11a3f0/a_pandas_ex_pairwise_explode-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-06 02:59:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "hansalemaos",
"github_project": "a_pandas_ex_pairwise_explode",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "a-pandas-ex-pairwise-explode"
}