I have a dataframe as follow:
| armed | signs_of_mental_illness | count |
|---|---|---|
| gun | False | 628 |
| gun | True | 155 |
| knife | False | 142 |
| vehicle | False | 104 |
| knife | True | 84 |
| metal pole | True | 1 |
| metal rake | True | 1 |
I want to sort this dataframe as follow:
| armed | signs_of_mental_illness | count |
|---|---|---|
| gun | False | 628 |
| gun | True | 155 |
| knife | False | 142 |
| knife | True | 84 |
I tired
armed_mental = focus_age_group.groupby(['armed', 'signs_of_mental_illness'])['id'].count().sort_values(ascending=False)
that had product above result. But I have difficulty getting what I want. The category (armed) with highest number(True + False) of should be on top of the dataframe. Then follow by True and False.