如何在matplotlib中的两组中绘制数据框的列的箱形图 [英] how to plot a box plot of a column of a data frame in two groups in matplotlib
本文介绍了如何在matplotlib中的两组中绘制数据框的列的箱形图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下数据框:
value total_spend margin
1 29493.14 10203.37
1 27551.22 19003.07
2 22881.26 15142.68
1 15254.77 12337.22
1 11873.95 9424.23
1 11382.89 8767.83
1 11006.11 6867.29
2 9647.16 7543.24
2 9227.57 9227.57
1 9077.39 6541.60
1 8912.10 4074.26
2 8560.05 7466.30
1 8041.52 7425.49
1 8007.19 5850.35
1 7914.47 3363.42
2 7812.48 4185.71
2 7441.81 7341.23
1 7388.98 6871.19
我需要绘制两个方框的图from'total_spend'列中的每个'value'组。同一图中的两个方框图
i need to make a two box plot from'total_spend' column for every group of 'value' . two box plot in the same plot
推荐答案
df.boxplot(column='total_spend', by='value')
这篇关于如何在matplotlib中的两组中绘制数据框的列的箱形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文