cudf.DataFrame.rmod#

DataFrame.rmod(other, axis='columns', level=None, fill_value=None)#

Get Modulo division of dataframe or series and other, element-wise (binary operator rmod).

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

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'])
>>> 100 % df
           angles  degrees
circle          0      100
triangle        1      100
rectangle       0      100
>>> df.rmod(100)
           angles  degrees
circle          0      100
triangle        1      100
rectangle       0      100

Series

>>> import cudf
>>> a = cudf.Series([10, 20, None, 30, 40], index=['a', 'b', 'c', 'd', 'e'])
>>> a
a      10
b      20
c    <NA>
d      30
e      40
dtype: int64
>>> b = cudf.Series([None, 1, 20, 5, 4], index=['a', 'b', 'd', 'e', 'f'])
>>> b
a    <NA>
b       1
d      20
e       5
f       4
dtype: int64
>>> a.rmod(b, fill_value=10)
a       0
b       1
c    <NA>
d      20
e       5
f       4
dtype: int64