使用pandas和matplotlib绘制分类数据

28 浏览
0 Comments

使用pandas和matplotlib绘制分类数据

我有一个包含分类数据的数据框:

     颜色    方向
1    红色   向上
2    蓝色   向上
3    绿色   向下
4    红色   向左
5    红色   向右
6    黄色   向下
7    蓝色   向下

我想根据这些分类生成一些图表,比如饼图和直方图。是否可以在不创建虚拟数值变量的情况下实现?类似于

df.plot(kind='hist')

0