get top items pandas 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: only get top 10 python dataframe
df[df['Ticket'] == 1].sort_values('Age')['Names'].head(10)