Giving the following dataframe:
name both one 1 \'ABC AB\' \'AA-BB\' 2 \'AB NNN\' \'AA-CC\' 3 \'CCC MM\' \'DD-BB\' 4 \'MM NNN\' \'DD-CC\'