scipy.stats.trimboth

scipy.stats.trimboth(a, proportiontocut, axis=0)[源代码]

从数组的两端切下一定比例的项。

从传递的数组的两端切下传递的项目比例(即,使用 proportiontocut =0.1,切片最左侧10% and 分数的最右边10%)。修剪后的值是最低和最高的值。如果比例导致非整数切片索引(即保守切片),则切片较少 proportiontocut )。

参数
aarray_like

要修剪的数据。

proportiontocut浮动

每一端修剪的总数据集的比例(在0-1范围内)。

axis整型或无型,可选

要沿其修剪数据的轴。默认值为0。如果没有,则对整个阵列进行计算 a

退货
outndarray

阵列的修剪版本 a 。裁剪内容的顺序未定义。

参见

trim_mean

示例

>>> from scipy import stats
>>> a = np.arange(20)
>>> b = stats.trimboth(a, 0.1)
>>> b.shape
(16,)