@@ -6084,8 +6084,64 @@ def rfloordiv(self, other, level=None, fill_value=None, axis: Axis = 0) -> Serie
60846084 other , roperator .rfloordiv , level = level , fill_value = fill_value , axis = axis
60856085 )
60866086
6087- @Appender (ops .make_flex_doc ("mod" , "series" ))
60886087 def mod (self , other , level = None , fill_value = None , axis : Axis = 0 ) -> Series :
6088+ """
6089+ Return Modulo of series and other, element-wise (binary operator `mod`).
6090+
6091+ Equivalent to ``series % other``, but with support to substitute a
6092+ fill_value for missing data in either one of the inputs.
6093+
6094+ Parameters
6095+ ----------
6096+ other : Series or scalar value
6097+ Series with which to compute modulo.
6098+ level : int or name
6099+ Broadcast across a level, matching Index values on the
6100+ passed MultiIndex level.
6101+ fill_value : None or float value, default None (NaN)
6102+ Fill existing missing (NaN) values, and any new element needed for
6103+ successful Series alignment, with this value before computation.
6104+ If data in both corresponding Series locations is missing
6105+ the result of filling (at that location) will be missing.
6106+ axis : {0 or 'index'}
6107+ Unused. Parameter needed for compatibility with DataFrame.
6108+
6109+ Returns
6110+ -------
6111+ Series
6112+ The result of the operation.
6113+
6114+ See Also
6115+ --------
6116+ Series.rmod : Reverse of the Modulo operator, see
6117+ `Python documentation
6118+ <https://docs.python.org/3/reference/datamodel.html#emulating-numeric-types>`_
6119+ for more details.
6120+
6121+ Examples
6122+ --------
6123+ >>> a = pd.Series([1, 1, 1, np.nan], index=["a", "b", "c", "d"])
6124+ >>> a
6125+ a 1.0
6126+ b 1.0
6127+ c 1.0
6128+ d NaN
6129+ dtype: float64
6130+ >>> b = pd.Series([1, np.nan, 1, np.nan], index=["a", "b", "d", "e"])
6131+ >>> b
6132+ a 1.0
6133+ b NaN
6134+ d 1.0
6135+ e NaN
6136+ dtype: float64
6137+ >>> a.mod(b, fill_value=0)
6138+ a 0.0
6139+ b NaN
6140+ c NaN
6141+ d 0.0
6142+ e NaN
6143+ dtype: float64
6144+ """
60896145 return self ._flex_method (
60906146 other , operator .mod , level = level , fill_value = fill_value , axis = axis
60916147 )
0 commit comments