cudf.Series.pow#

Series.pow(other, level=None, fill_value=None, axis=0)#

Get Exponential power of dataframe series and other, element-wise (binary operator pow).

Equivalent to frame ** other, but with support to substitute a fill_value for missing data in one of the inputs. With reverse version, rpow.

Parameters
otherscalar, sequence, Series, or DataFrame

Any single or multiple element data structure, or list-like object.

axisint or string

Only 0 is supported for series, 1 or columns supported for dataframe

fill_valuefloat or None, default None

Fill existing missing (NaN) values, and any new element needed for successful DataFrame alignment, with this value before computation. If data in both corresponding DataFrame locations is missing the result will be missing.

Returns
DataFrame or Series

Result of the arithmetic operation.

Examples

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