I'm trying to sort two pandas dataframe columns. I understand that Python has its own built-in function:
.sort()
But I'm wondering if Pandas has this function too and if it can be done with two columns together, as a pair.
Say for example I have the following dataset:
sum feature
0 5.1269 3
1 2.8481 2
2 -1.472 1
3 -3.212 0
I want to obtain this:
sum feature
0 -3.212 0
1 -1.472 1
2 2.8481 2
3 5.1269 3
Basically what I am doing here, is I am sorting the column 'feature' to get it from minimum to maximum, however I want the corresponding values in 'sum' to also change.
Can someone please help me out with this? I have seen other posts around Stackoverflow on this, however I have not found a detailed answer explaining the process, or an answer for this specific question.