Metadata-Version: 2.1
Name: a_pandas_ex_pairwise_explode
Version: 0.10
Summary: Pairwise explode columns in a pandas DataFrame
Home-page: https://github.com/hansalemaos/a_pandas_ex_pairwise_explode
Author: Johannes Fischer
Author-email: <aulasparticularesdealemaosp@gmail.com>
License: MIT
Keywords: pandas,explode
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Editors :: Text Processing
Classifier: Topic :: Text Processing :: General
Classifier: Topic :: Text Processing :: Indexing
Classifier: Topic :: Text Processing :: Filters
Classifier: Topic :: Utilities
Description-Content-Type: text/markdown
License-File: LICENSE.rst


# 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
"""



```



