print only the max value group by multiple columns in pandas code example
Example: Pandas groupby max multiple columns in pandas
annotations.groupby(['bookid','conceptid'], sort=False)['weight'].max()
annotations.groupby(['bookid','conceptid'], sort=False)['weight'].max()