I have a dataframe
df1 = pd.DataFrame({'value': [100, 100, 100, 200, 300, 300, 400], 'owner': list('aabbaba')}) value owner 100 a 100 a 100 b 200 b 300 a 300 b 400 a I need to groupby the value column and produce a new output such that no duplicates exist in the value column. A value that is linked to both a and b should have an owner value of both while a value with only a single owner should just have that owner.
Output desired:
value owner 100 both 200 b 300 both 400 a Thanks for the help