cudf.DataFrame.rtruediv#

DataFrame.rtruediv(other, axis='columns', level=None, fill_value=None)[source]#

Get Floating division of DataFrame or Series and other, element-wise (binary operator rtruediv).

Equivalent to frame + other, but with support to substitute a fill_value for missing data in one of the inputs.

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

levelint or name

Broadcast across a level, matching Index values on the passed MultiIndex level. Not yet supported.

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

>>> df = cudf.DataFrame(
...     {'angles': [0, 3, 4], 'degrees': [360, 180, 360]},
...     index=['circle', 'triangle', 'rectangle']
... )
>>> df.rtruediv(1)
            angles   degrees
circle          inf  0.002778
triangle   0.333333  0.005556
rectangle  0.250000  0.002778

Series

>>> a = cudf.Series([1, 1, 1, None], index=['a', 'b', 'c', 'd'])
>>> b = cudf.Series([1, None, 1, None], index=['a', 'b', 'd', 'e'])
>>> a.rtruediv(b)
a     1.0
b    <NA>
c    <NA>
d    <NA>
e    <NA>
dtype: float64
>>> a.rtruediv(b, fill_value=0)
a     1.0
b     0.0
c     0.0
d     Inf
e    <NA>
dtype: float64