pandas.core.resample.Resampler.quantile #
- 最终 重采样器。分位数( q = 0.5 , ** kwargs ) [来源] #
返回给定分位数的值。
- 参数:
- q浮点数或类数组,默认 0.5(50% 分位数)
- 返回:
- 数据框或系列
每组内值的分位数。
也可以看看
Series.quantile
返回一个序列,其中索引是 q,值是分位数。
DataFrame.quantile
返回一个 DataFrame,其中列是 self 的列,值是分位数。
DataFrameGroupBy.quantile
返回一个 DataFrame,其中列是 groupby 列,值是其分位数。
例子
>>> ser = pd.Series([1, 3, 2, 4, 3, 8], ... index=pd.DatetimeIndex(['2023-01-01', ... '2023-01-10', ... '2023-01-15', ... '2023-02-01', ... '2023-02-10', ... '2023-02-15'])) >>> ser.resample('MS').quantile() 2023-01-01 2.0 2023-02-01 4.0 Freq: MS, dtype: float64
>>> ser.resample('MS').quantile(.25) 2023-01-01 1.5 2023-02-01 3.5 Freq: MS, dtype: float64