pandas top 10 values code example
Example 1: nlargest
>>> df.nlargest(3, 'population')
population GDP alpha-2
France 65000000 2583560 FR
Italy 59000000 1937894 IT
Malta 434000 12011 MT
Example 2: pandas top 10 values of a column
df.sort_values(['item', 'value'], ascending=False).groupby('item').head(10)