Pandas get the most frequent values of a column
By using mode
df.name.mode()
Out[712]:
0 alex
1 helen
dtype: object
To get the n
most frequent values, just subset .value_counts()
and grab the index:
# get top 10 most frequent names
n = 10
dataframe['name'].value_counts()[:n].index.tolist()