考虑我的系列如下:第一列是ToeLoY-ID,第二列是频率计数。
article_id
1 39
2 49
3 187
4 159
5 158
...
16947 14
16948 7
16976 2
16977 1
16978 1
16980 1
Name: article_id, dtype: int64
我使用以下命令从数据帧中获取此系列:
logs.loc[logs['article_id'] <= 17029].groupby('article_id')['article_id'].count()
logs是这里的数据框架,article_id是其中的一列
如何绘制条形图(使用Matlplotlib),使文章\u id位于X轴上,并且Y轴上的频率计数
我的本能是使用.tolist()将其转换为列表,但这并不能保留文章的id
只需在绘图的实物参数中使用“bar”
示例
种类的默认值为“线”(即series.plot()>;将自动绘制线图)
供您参考:
IIUC您需要^{} :
样本:
新的pandas API建议如下:
如果您正在使用Jupyter,则不需要
matplotlib
库相关问题 更多 >
编程相关推荐