[英]Plotting a bar chart in pandas dataframe
我有一個看起來像這樣的熊貓數據框:
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()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.