I need to sort(in a descending order) a dataframe according to multiple columns using the following piece of code:
df = df.sort_values(measures, ascending = (False,False,False,False,False))
where 'measures' is a list of columns names. As a result I only get the dataframe sorted by the first column (ms1) in 'measures' list.
a snippet of the dataframe before sorting:
Features ms1 ... ms4 ms5
0 age 0.188 ... 0.025 0.994
1 sex 0.556 ... 0.040 8.080
2 cp 0.437 ... 0.054 20.121
3 trestbps 0.199 ... 0.015 0.512
4 chol 0.194 ... 0.002 0.085
5 fbs 0.622 ... 0.030 0.055
And after sorting:
Features ms1 ... ms4 ms5
5 fbs 0.622 ... 0.030 0.055
8 exang 0.593 ... 0.023 36.842
1 sex 0.556 ... 0.040 8.080
12 thal 0.527 ... 0.007 1.902
6 restecg 0.488 ... 0.067 1.219
does anyone know why it is not working properly