I have a dataframe that looks like this:
df
col1 col2 col3
0 1 "A" 10
1 1 "B" 20
2 1 "C" 30
...
n k "A" 15
n+1 k "B" 10
n+2 k "C" 5
I would like to compare the col3 values across rows with matching col1 values with specific values of col2("A" vs "B" and "A" vs "C").
Let's suppose I generate a resulting data analysis dataframe, it will look like this:
da_df
col1 col2
0 "AvsB" 33.3 #10/30*100
1 "AvsC" 50.0 #10/20*100
...
2k "AvsB" 150 #15/10*100
2k+1 "AvsC" 300 #15/5*100
How can I do it without for loops?