想要用我拥有的两个数据集绘制斜率图

时间:2017-12-07 13:38:15

标签: python pandas matplotlib jupyter

我目前正在分析2016年4月至2017年3月期间的街头犯罪数据。我在2015年4月至2016年3月期间发现了相同的犯罪数据。我想以“a'”的形式比较我所拥有的两个数据集。斜率图,用于显示犯罪类型对这两个数据集的犯罪事件的变化。

这是我为4月15日至3月16日创建饼图的代码。

b = apr15tomar16.groupby('Crime type').size()
print (b)
plt.title('Crimes by Crime type from April 2015 to March 2016')
b.plot.pie(figsize=(10,10), autopct='%1.1f%%')

Pie chart showing crimes from April 2015 to March 2016

这是我为4月16日至3月17日创建饼图的代码。

c = apr16tomar17.groupby('Crime type').size()
print (c)
plt.title('Crimes by Crime type from April 2016 to March 2017')
c.plot.pie(figsize=(10,10), autopct='%1.1f%%')

Pie chart showing crimes from April 2016 to March 2017

我觉得自己走在正确的轨道上,但是我不太清楚如何比较这些。理想情况下,我想使用斜率图。任何方向都会受到赞赏。

编辑:为了澄清,我想象一个这样的图: Slope graph example

0 个答案:

没有答案