What is the simplest way to compare two columns using groupby - without apply/lambda?
df product1 product2 person
0 apple apples abby
1 apple apple abby
...
df.groupby("person").product1.eq(df.groupby("person").product2)
Expected Output
0 False
1 True
A bit tricky to solve without
applybut you can usemergeto compare ('person', 'product2) to ('person', 'product1'):