我有一个 pandas 数据框,如下所示:
Date Day_of_month
2017/1/16 16
2016/2/16 16
2018/1/16 16
2015/1/17 17
2013/1/18 18
如何在 x 轴上绘制该月中的某一天并在 y 轴上绘制该月中特定日期(例如 16)的条目数的条形图?
最佳答案
使用Series.value_counts
, Series.sort_index
最后Series.plot.bar
:
df['Day_of_month'].value_counts().sort_index().plot.bar()
关于python - 在 pandas 数据框中绘制条形图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49710178/