get max value from group by using 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()