用法:
DataFrame.pow(other, axis='columns', level=None, fill_value=None)
獲取數據幀係列和其他元素的 index 冪(二元運算符
pow
)。等效於
frame ** other
,但支持用 fill_value 替換其中一個輸入中的缺失數據。使用反向版本rpow
。- other:標量、序列、係列或數據幀
任何單元素或多元素數據結構,或list-like 對象。
- axis:整數或字符串
係列僅支持
0
,數據幀支持1
或columns
- fill_value:浮點數或無,默認無
在計算之前使用此值填充現有的缺失 (NaN) 值以及成功對齊 DataFrame 所需的任何新元素。如果兩個相應的 DataFrame 位置中的數據都丟失,則結果將丟失。
- DataFrame或Series
算術運算的結果。
參數:
返回:
例子:
DataFrame
>>> import cudf >>> df = cudf.DataFrame({'angles': [1, 3, 4], ... 'degrees': [360, 180, 360]}, ... index=['circle', 'triangle', 'rectangle']) >>> df ** 2 angles degrees circle 0 129600 triangle 9 32400 rectangle 16 129600 >>> df.pow(2) angles degrees circle 0 129600 triangle 9 32400 rectangle 16 129600
Series
>>> import cudf >>> a = cudf.Series([1, 2, 3, None], index=['a', 'b', 'c', 'd']) >>> a a 1 b 2 c 3 d <NA> dtype: int64 >>> b = cudf.Series([10, None, 12, None], index=['a', 'b', 'd', 'e']) >>> b a 10 b <NA> d 12 e <NA> dtype: int64 >>> a.pow(b, fill_value=0) a 1 b 1 c 1 d 0 e <NA> dtype: int64
相關用法
- Python cudf.DataFrame.prod用法及代碼示例
- Python cudf.DataFrame.pivot用法及代碼示例
- Python cudf.DataFrame.product用法及代碼示例
- Python cudf.DataFrame.pipe用法及代碼示例
- 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用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.DataFrame.pow。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。