I have a pandas data frame sample dataframe
df =    a1   a2   a3   a4   a5 
         0    1    1     1    0      #dict[a3_a4]  = 1 ,dict[a2_a4]  = 1 ,dict[a2_a3]  = 1
         1    1    1     0    0      #dict[a1_a2]  = 1 , dict[a1_a3]  = 1, dict[a2_a3]  = 1
I need function gets data frame as input and return the number of appearing of 2 columns together and store it in the dictionary so my output will be like
output dict will look like this : {'a1_a2':1,'a2_a3':2, 'a3_a4':1,'a1_a3':1,'a2_a4':1}
PS: I am new to stack overflow so forgive me for my mistakes.

 
    