Say we have used pandas dataframe[column].value_counts()
which outputs:
apple 5
sausage 2
banana 2
cheese 1
How do you extract the values in the order same as shown above from max to min ?
e.g: [apple,sausage,banana,cheese]
Try this:
dataframe[column].value_counts().index.tolist()
['apple', 'sausage', 'banana', 'cheese']