用法:
DataFrame.quantile(q=0.5, axis=0, numeric_only=True, interpolation='linear', columns=None, exact=True)
返回给定分位数的值。
- q:浮点数或array-like
0 <= q <= 1,要计算的分位数
- axis:int
轴是一个非函数参数
- numeric_only:布尔值,默认为真
如果为 False,还将计算 datetime 和 timedelta 数据的分位数。
- interpolation:{
linear
,lower
,higher
,midpoint
,nearest
} 当所需的分位数位于两个数据点 i 和 j 之间时,此参数指定要使用的插值方法。默认
linear
。- columns:str 列表
要包含的列名列表。
- exact:布尔值
是否使用近似或精确分位数算法。
- Series或DataFrame
如果 q 是一个数组或numeric_only 设置为 False,将返回一个 DataFrame,其中 index 为 q,列是 self 的列,值是分位数。
如果 q 是浮点数,则将返回一个 Series,其中索引是 self 的列,值是分位数。
参数:
返回:
注意:
与 Pandas 的一个显著区别是,当 DataFrame 是非数字类型时,如果是 Pandas,结果预计是 Series。 cuDF 将返回一个 DataFrame,因为它不支持 Series 下的混合类型。
例子:
>>> import cupy as cp >>> import cudf >>> df = cudf.DataFrame(cp.array([[1, 1], [2, 10], [3, 100], [4, 100]]), ... columns=['a', 'b']) >>> df a b 0 1 1 1 2 10 2 3 100 3 4 100 >>> df.quantile(0.1) a 1.3 b 3.7 Name: 0.1, dtype: float64 >>> df.quantile([.1, .5]) a b 0.1 1.3 3.7 0.5 2.5 55.0
相关用法
- Python cudf.DataFrame.query用法及代码示例
- Python cudf.DataFrame.mod用法及代码示例
- Python cudf.DataFrame.isin用法及代码示例
- Python cudf.DataFrame.rmul用法及代码示例
- Python cudf.DataFrame.apply用法及代码示例
- Python cudf.DataFrame.exp用法及代码示例
- Python cudf.DataFrame.drop用法及代码示例
- Python cudf.DataFrame.where用法及代码示例
- Python cudf.DataFrame.median用法及代码示例
- Python cudf.DataFrame.to_pandas用法及代码示例
- Python cudf.DataFrame.take用法及代码示例
- Python cudf.DataFrame.tail用法及代码示例
- Python cudf.DataFrame.rfloordiv用法及代码示例
- Python cudf.DataFrame.equals用法及代码示例
- Python cudf.DataFrame.head用法及代码示例
- Python cudf.DataFrame.count用法及代码示例
- Python cudf.DataFrame.isna用法及代码示例
- Python cudf.DataFrame.groupby用法及代码示例
- Python cudf.DataFrame.round用法及代码示例
- Python cudf.DataFrame.cumsum用法及代码示例
注:本文由纯净天空筛选整理自rapids.ai大神的英文原创作品 cudf.DataFrame.quantile。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。