Reb*_*cca 2 python dataframe pandas jupyter
我正在创建一个在 x 轴上有“月份”的条形图,但是它们以随机顺序显示,我如何对月份进行逻辑排序,即一月、二月、三月...
这是我的代码...
plt.figure(figsize=(15,10))
sns.countplot(x=boeing_df.order_month);
plt.title('Most Popular Order Month');ype here
Run Code Online (Sandbox Code Playgroud)
TIA
您可以使用order参数countplot并为其提供月份列表。一个方便的方法可能是使用calendar.month_abbr:
import calendar
sns.countplot(x=boeing_df.order_month, order=calendar.month_abbr[1:])
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
61 次 |
| 最近记录: |