pandas.Series.mod¶
Return Modulo of series and other, element-wise (binary operator mod).
Equivalent to series % other
, but with support to substitute a fill_value for
missing data in one of the inputs.
- param other
Series or scalar value
- param fill_value
- None or float value, default None (NaN)
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result will be missing.
- param level
- int or name
Broadcast across a level, matching Index values on the passed MultiIndex level.
- return
Series The result of the operation.
Limitations¶
Parameter
axis
is supported only with default value0
.Parameters
level
andfill_value
are supported only with default valueNone
.
Examples¶
import pandas as pd
from numba import njit
@njit
def series_mod():
s1 = pd.Series([5, 4, 3, 2, 1])
s2 = pd.Series([0, 2, 3, 6, 8])
return s1.mod(s2) # Expect series of 0, 0, 0, 2, 1
print(series_mod())
$ python ./series/series_mod.py
0 0
1 0
2 0
3 2
4 1
dtype: int64