时间序列条图显示值是给定时间段的总和
有一个时间序列数据,例如以下数据。
import pandas as pd
data = {'Time': ['2/10/2019', '3/3/2019', '3/15/2019', '3/25/2019', '4/16/2019', '4/17/2019', '5/6/2019', '5/18/2019'],
'Order nun': [200, 150, 50, 100, 90, 190, 120, 110]}
df = pd.DataFrame(data)
Time Order nun
0 2/10/2019 200
1 3/3/2019 150
2 3/15/2019 50
3 3/25/2019 100
4 4/16/2019 90
5 4/17/2019 190
6 5/6/2019 120
7 5/18/2019 110
如何基于月度值的总和来生成时间序列栏图。
There has a time series data, such as the following ones.
import pandas as pd
data = {'Time': ['2/10/2019', '3/3/2019', '3/15/2019', '3/25/2019', '4/16/2019', '4/17/2019', '5/6/2019', '5/18/2019'],
'Order nun': [200, 150, 50, 100, 90, 190, 120, 110]}
df = pd.DataFrame(data)
Time Order nun
0 2/10/2019 200
1 3/3/2019 150
2 3/15/2019 50
3 3/25/2019 100
4 4/16/2019 90
5 4/17/2019 190
6 5/6/2019 120
7 5/18/2019 110
How to generate a time series bar plot based on the sum of monthly value.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(2)
您可以将
time
设置为索引并使用”pd.grouper(freq ='m')
to groupby月bar如此薄月。您可以使用字符串使其正常。
You can set the
Time
as index and usepd.Grouper(freq='M')
to groupby monthThe reason why the bar is so thin is that the bar only takes one day in a month. You can use string instead to make it normal.
输出:
Output: