pandas groupby for max agg on one column and other corresponding values 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()