【发布时间】:2020-04-19 20:03:49
【问题描述】:
我正在尝试为时间序列数据制作条形图/计数图:
avg_curr1 = df[df['name'] == 'name1'].groupby(["Week of the Month", "Month"]).count()
print(avg_curr1)
输出:
Week of the Month Month col1 col2 col3 col3 col4
1 10 1055 1055 1055 1055 1055
11 842 842 842 842 842
12 789 789 789 789 789
2 10 668 668 668 668 668
11 846 846 846 846 846
12 802 802 802 802 802
3 10 752 752 752 752 752
11 684 684 684 684 684
12 134 134 134 134 134
4 10 447 447 447 447 447
11 462 462 462 462 462
12 386 386 386 386 386
5 9 58 58 58 58 58
10 265 265 265 265 265
11 140 140 140 140 140
12 230
所以基本上,这些是过去三个月的计数值,已分组到每个星期。
然后我尝试了:
sns.set(style="darkgrid")
ax = sns.countplot(x="avg_curr1", data=avg_curr1, hue = 'Month')
这引发了一个值错误。
我是否错误地汇总了数据?在此先感谢您的任何建议!
【问题讨论】:
标签: python matplotlib data-visualization seaborn