我从几个Excel文件中读取了一组数据。我可以很容易地阅读,合并和分组的数据与熊猫。我对数据有两列感兴趣的“产品类型”和“测试持续时间”
包含从Excel文件读取的数据的数据帧称为oData。在
oDataGroupedByProductType = oData.groupby(['Product Type'])
我用plotly绘制了一个图,如下所示,但是plotly不将数据保密,如果我想让数据私有化,我必须付费。付款不是一种选择。 如何使用pandas和/或matplotlib制作相同的图形,但也要显示每个产品类型的平均值?在
正如Bound所说,您可以用stripplot(seaborn文档页面的示例)几行来完成。在
假设您有一些数据帧:
您需要有一个数字值,以便产品绘制它,所以快速而干练,只需通过映射数值来创建一个新列:
^{pr2}$当然,有很多方法可以达到这个目的。。。在
现在,创建一个新列:
现在,在
pandas
中使用plot
助手方法,它基本上是matplotlib
的包装:以及输出:
很明显,这是快速和肮脏的,但它应该让你的方式。。。在
如果其他人有一个非常类似的问题,并希望看到最终结果,我最终使用了seaborn,如下所示:
图表如下所示。出于隐私的原因,我已经模糊了图表上的产品标签。在
相关问题 更多 >
编程相关推荐