用法:
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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。