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