Pandas: Pivot to True/False, drop column
问题 I'm trying to create what I think is a simple pivot table but am having serious issues. There are two things I'm unable to do: Get rid of the "partner" column at the end. Set the values to either True or False if each company has that partner. Setup: df = pd.DataFrame({'company':['a','b','c','b'], 'partner':['x','x','y','y'], 'str':['just','some','random','words']}) Desired Output: company x y a True False b True True c False True I started with: df = df.pivot(values = 'partner', columns =