Consider the following Pyspark dataframe
Col1 | Col2 | Col3 |
---|---|---|
A | D | G |
B | E | H |
C | F | I |
How can I create the following dataframe which has all pairwise combinations of all the columns?
Col1 | Col2 | Col3 | Col1_Col2_cross | Col1_Col3_cross | Col2_Col3_cross |
---|---|---|---|---|---|
A | D | G | A,D | A,G | D,G |
B | E | H | B,E | B,H | E,H |
C | F | I | C,F | C,I | F,I |