I have a Dataframe that looks like this:
| Col 1 | Col 2 | 0| A | 2 | 1| A | 3 | 2| B | 1 | 3| B | 2 |
an
You could use:
df.groupby(['Col 1','Col 2']).size().unstack(fill_value=0).astype(bool) Col2 1 2 3 Col1 A False True True B True True False