2024-10-01 22:39:18 发布
网友
使用Pandas DataSeries在Jupyter中工作时,我有一个数据集,其行如下:
color: white engineType: diesel make: Ford manufacturingYear: 2004 accidentCount: 123
我需要做的是按制造年份(x轴)绘制所有颜色/发动机类型/品牌排列的事故计数(y轴)图表。有什么办法吗?在
为了加快速度,我做了以下初始设置:
使用^{}可以通过唯一的color、engineType和{}组合来获得事故数量:
color
engineType
accident_counts = df.groupby(['color', 'engineType', 'make'])['accidents'].sum()
Matplotlib是绘制结果的一种方法:
使用^{} 可以通过唯一的}组合来获得事故数量:
color
、engineType
和{Matplotlib是绘制结果的一种方法:
^{pr2}$相关问题 更多 >
编程相关推荐