open_in_new
content_copy
df.groupby(['id', 'group', 'term']).size().unstack(fill_value=0)