Sort_values() doesn't work

I have calculated the “earn >50K countries”, and used “.sort_values(ascending=False)” to sort the highest value (Iran). However, it becomes Haiti, which is obviously not the highest value in the DataFrame. Can anyone please help me figure out why “sort_values()” doesn’t work in this situation? Thank you so much!!

can we get a clue please? (you haven’t mentioned what problem this is. A link to it so people can understand it would be helpful)

your percentages are being sorted as strings, not as numbers, but other than that we can’t know what’s going on

Thanks hbar1st, I finally sort out the problem as I sort it by using the strings, not the value. After that I used .max() and figure out the solution.

Thanks ilenia, your view is correct. Now I sort out the problem thanks to your help.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.