Custom sorting with Pandas
问题 I have the following dataframe that I would like to sort first by Criticality and then by Name: Name Criticality baz High foo Critical baz Low foo Medium bar High bar Low bar Medium ... I've been trying to do this using the answer provided in this post but I just can't get it to work. The end result should be like this Name Criticality bar High bar Medium bar Low baz High baz Low foo Critical foo Medium 回答1: One approach would be to use a custom dict to create a 'rank' column, we then use to