Fill cell within a dataframe according to another dataframe [python]

Here is a solution using mask()

df is Tab1 and df2 is Tab2

df = df.set_index('Groups')
(df.mask(df.eq(1),
         df2.set_index(['Groups','SP_names'])['SP_names2'].unstack())
 .reset_index())

Output:

   Groups ORFs_values     SP1     SP2    SP3
0  Group1     SP_ORF1   SP1_A   SP2_A      0
1  Group2     SP_ORF1       0       0      0
2  Group3     SP_ORF1       0  SP2_BL      0
3  Group4     SP_ORF1  SP1_BI  SP2_OP  SP3_I