maxframe.dataframe.Series.quantile#
- Series.quantile(q=0.5, interpolation='linear')#
返回给定分位数处的值。
- 参数:
q (float or array-like, default 0.5 (50% quantile)) -- 0 <= q <= 1,要计算的分位数。
interpolation ({'linear', 'lower', 'higher', 'midpoint', 'nearest'}) -- 此可选参数指定当所需的分位数位于两个数据点 i 和 j 之间时使用的插值方法: * linear: i + (j - i) * fraction,其中 fraction 是索引在 i 和 j 之间的分数部分。 * lower: i。 * higher: j。 * nearest: 最接近的 i 或 j。 * midpoint: (i + j) / 2。
- 返回:
如果
q是数组或张量,则返回一个 Series,其索引为q,值为分位数;否则返回一个浮点数。- 返回类型:
参见
core.window.Rolling.quantile,numpy.percentile示例
>>> import maxframe.dataframe as md >>> s = md.Series([1, 2, 3, 4]) >>> s.quantile(.5).execute() 2.5 >>> s.quantile([.25, .5, .75]).execute() 0.25 1.75 0.50 2.50 0.75 3.25 dtype: float64