We have a DataFrame with 2 columns as follows:
|Type |list_dates |
|:----:|:-----------:|
|1 |['a','b','c']|
|2 |['d','e','f','g']|
We need to generate a combination of all list elements while duplicating the Type, as follows:
|Type |list_dates |
|:----:|:-----------:|
|1 |['a','b']|
|1 |['a','c']|
|1 |['b','c']|
|2 |['d','e']|
|2 |['e','f']|
.....
In order to generate the combinations we are using the following code:
import itertools
list(itertools.combinations(df.list_dates,2) )
Any suggestions?