Answers for "get top 5 values pandas"

2

pandas find top 10 values in column

#df.nlargest(How many largest Values, 'Col_name')
>>> df.nlargest(3, 'a')
    a  b   c
3  11  c   3
1  10  b   2
2   8  d NaN
Posted by: Guest on May-07-2021
3

nlargest

>>> df.nlargest(3, 'population')
        population      GDP alpha-2
France    65000000  2583560      FR
Italy     59000000  1937894      IT
Malta       434000    12011      MT
Posted by: Guest on March-18-2020
0

only get top 10 python dataframe

df[df['Ticket'] == 1].sort_values('Age')['Names'].head(10)
Posted by: Guest on January-22-2020

Python Answers by Framework

Browse Popular Code Answers by Language