我正在用熊猫做一个盒子。在
我的数据框看起来像这样
Year 2013 2014 2015 2016 2017
dfMin 1.091603 0.973346 1.040000 0.855209 1.079500
dfLowerQuartile 1.727191 1.684009 1.275601 1.136703 2.262654
dfUpperQuartile 2.225000 2.000000 1.857570 2.120644 2.435724
dfMax 2.687323 2.350000 2.105000 2.250000 2.566467
我的图表代码是这样的
^{pr2}$我对2017年的较低价值表示困惑。在
有人知道如何解决这个问题吗?在
这是2017年的异常值。如果您对该观察结果不感兴趣,您只需在数据集中删除它,知道它会更改相应统计度量值的值。在
接下来会发生什么?在
它计算出这四个值中的分位数,值1被解释为离群值。所以:你使用的实际指数被忽略了,pandas将这些值作为数据点。在
因此,实际上,您不应该自己设置最小值、最大值和分位数,而是应该将数据帧中的完整数据传递到盒形图。在
这是预期的行为。您2017年的最小值比提供的四个数据点的第一个四分位数低1.5 IQR以上,在这种情况下,最小值显示为异常值(a点)。在
从the docs到
boxplot
(emphasis mine):所以如果你想让胡须一直延伸
相关问题 更多 >
编程相关推荐