given a dataframe that logs uses of some books like this:
Name Type ID Book1 ebook 1 Book2 paper 2 Book3 paper 3 Book1 ebook 1 Book2 paper 2 >
I think as_index=False should do the trick.
df.groupby(['Name','Type','ID'], as_index=False).count()