I apologize if the wording for this question is strange. I wasn't sure how to phrase it.
I have a python pandas data frame like this:
data = pd.DataFrame({"a":[1,4,5,4,2], "b":[1,1,2,1,1]})
a b
1 1
3 1
5 2
4 1
2 1
I need to sort the data so that column b is descending, but for ties (all of the 1s in column b), values in column a are sorted ascending.
So it should look like this:
a b
5 2
1 1
2 1
3 1
4 1
Any help is appreciated, thank you.