I have the following dataframe...
df1:
playerA   playerB  PlayerC PlayerD
kim         lee      b      f
jackson     kim      d      g
dan         lee      a      d
I want to generate a new data frame with all possible combinations of two columns. For example,
df_new:
Target   Source  
kim         lee
kim         kim
kim         lee
kim          b     
kim          d
kim          a
kim          f
kim          g
kim          d      
jackson      lee
jackson      kim
jackson      lee
jackson      b
.
.
.
.
lee         kim
lee         jackson
lee          dan
lee          b
lee          d
.
.
.
Thus, I tried this code t
import itertools
def comb(df1):
    return [df1.loc[:, list(x)].set_axis(['Target','Source'], axis=1)
            for x in itertools.combinations(df1.columns, 2)]
However, It only shows combinations between columns in the same row.
Is there any way that I could generate all the possible combination between columns? Thanks in advance!
 
     
     
    