cudf.Series.rtruediv#
- Series.rtruediv(other, level=None, fill_value=None, axis=0)#
Get Floating division of dataframe or series and other, element-wise (binary operator rtruediv).
Equivalent to
other / frame
, but with support to substitute a fill_value for missing data in one of the inputs. With reverse version, truediv.- 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
orcolumns
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': [0, 3, 4], ... 'degrees': [360, 180, 360]}, ... index=['circle', 'triangle', 'rectangle']) >>> df angles degrees circle 0 360 triangle 3 180 rectangle 4 360 >>> df.rtruediv(10) angles degrees circle inf 0.027778 triangle 3.333333 0.055556 rectangle 2.500000 0.027778 >>> df.rdiv(10) angles degrees circle inf 0.027778 triangle 3.333333 0.055556 rectangle 2.500000 0.027778 >>> 10 / df angles degrees circle inf 0.027778 triangle 3.333333 0.055556 rectangle 2.500000 0.027778
Series
>>> import cudf >>> a = cudf.Series([10, 20, None, 30], index=['a', 'b', 'c', 'd']) >>> a a 10 b 20 c <NA> d 30 dtype: int64 >>> b = cudf.Series([1, None, 2, 3], index=['a', 'b', 'd', 'e']) >>> b a 1 b <NA> d 2 e 3 dtype: int64 >>> a.rtruediv(b, fill_value=0) a 0.1 b 0.0 c <NA> d 0.066666667 e Inf dtype: float64