5)numpy中计算分位数的函数:quantile()
x = np.arange(10,19)
np.quantile(x,[0.25,0.5,0.75])
x = np.arange(10,20)
np.quantile(x,[0.25,0.5,0.75])
结果如下:
从结果中可以看到:上述我们自己计算的分位数结果,和使用该函数计算的分位数的结果,是一样的。
6)pandas中计算分位数的函数:describe()
x = pd.Series(np.arange(10,19))
x.describe()
x = pd.Series(np.arange(10,20))
x.describe()
结果如下:
注意:describe()中可以传入percentiles参数,获取指定分位数的值。
x = pd.Series(np.arange(10,19))
x.describe(percentiles=[0.25,0.5,0.75,0.9])
结果如下:
6、离散程度
1)极差、方差、标准差的概念