【发布时间】:2015-11-04 02:55:09
【问题描述】:
我正在尝试在 Python 中使用 Pandas 和 Matplotlib 来绘制多年来收到的赠款总额。数据类型“奖励生效日期”是收到赠款的日期。我用以下代码总结了多年来收到的赠款每天的金额:
#Displays daily sums of awards from FY12 to FY16
# *Revise ledger so only FY year dates are reported, not days.
df.groupby('Award Effective Date').award_amount.sum().plot(kind='bar',color=['orange'],\
figsize=(25,10),title="Daily Sums of Awards FY12 to FY16",\
grid=True)
这绘制了我需要的内容,但 x 轴标签混乱且难以辨认,因为它在过去几年中每天都在读取。如何将其更改为仅读取年份而不是每天?我还有另一种名为“EffDate 的财政年度”的数据类型,它记录该日期的财政年度——如果可以使用的话。
【问题讨论】:
标签: python pandas matplotlib