作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在创建一个在 x 轴上有“月份”的条形图,但是它们以随机顺序显示,我如何对月份进行逻辑排序,即一月、二月、三月...
这是我的代码...
plt.figure(figsize=(15,10))
sns.countplot(x=boeing_df.order_month);
plt.title('Most Popular Order Month');ype here
TIA
最佳答案
您可以使用countplot
的order
参数并给出你的月份 list 。一个方便的方法可能是使用 calendar.month_abbr
:
import calendar
sns.countplot(x=boeing_df.order_month, order=calendar.month_abbr[1:])
关于python - 如何在 python 中按分类顺序排序月份,即一月、二月、三月等......?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75215646/
我是一名优秀的程序员,十分优秀!