pandas multiple group by and select max 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()