Python 中按照索引排序时索引出现1 10 11 12 2...这样的顺序

Python 中按照索引排序时索引出现1 10 11 12 2...这样的顺序,怎么调整?
month_sales = month_sales.sort_index()```
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/144732563376134.png "#left")

因为你这里面放的是字符串,按字符串排序就是这样的
你想按数字排序,可以先转数字再排序,也可以传入一个排序函数