@@ -5973,14 +5973,76 @@ def rsub(self, other, level=None, fill_value=None, axis: Axis = 0) -> Series:
5973
5973
other , roperator .rsub , level = level , fill_value = fill_value , axis = axis
5974
5974
)
5975
5975
5976
- @Appender (ops .make_flex_doc ("mul" , "series" ))
5977
5976
def mul (
5978
5977
self ,
5979
5978
other ,
5980
5979
level : Level | None = None ,
5981
5980
fill_value : float | None = None ,
5982
5981
axis : Axis = 0 ,
5983
5982
) -> Series :
5983
+ """
5984
+ Return Multiplication of series and other, element-wise (binary operator `mul`).
5985
+
5986
+ Equivalent to ``series * other``, but with support to substitute
5987
+ a fill_value for missing data in either one of the inputs.
5988
+
5989
+ Parameters
5990
+ ----------
5991
+ other : Series or scalar value
5992
+ With which to compute the multiplication.
5993
+ level : int or name
5994
+ Broadcast across a level, matching Index values on the
5995
+ passed MultiIndex level.
5996
+ fill_value : None or float value, default None (NaN)
5997
+ Fill existing missing (NaN) values, and any new element needed for
5998
+ successful Series alignment, with this value before computation.
5999
+ If data in both corresponding Series locations is missing
6000
+ the result of filling (at that location) will be missing.
6001
+ axis : {0 or 'index'}
6002
+ Unused. Parameter needed for compatibility with DataFrame.
6003
+
6004
+ Returns
6005
+ -------
6006
+ Series
6007
+ The result of the operation.
6008
+
6009
+ See Also
6010
+ --------
6011
+ Series.rmul : Reverse of the Multiplication operator, see
6012
+ `Python documentation
6013
+ <https://docs.python.org/3/reference/datamodel.html#emulating-numeric-types>`_
6014
+ for more details.
6015
+
6016
+ Examples
6017
+ --------
6018
+ >>> a = pd.Series([1, 1, 1, np.nan], index=["a", "b", "c", "d"])
6019
+ >>> a
6020
+ a 1.0
6021
+ b 1.0
6022
+ c 1.0
6023
+ d NaN
6024
+ dtype: float64
6025
+ >>> b = pd.Series([1, np.nan, 1, np.nan], index=["a", "b", "d", "e"])
6026
+ >>> b
6027
+ a 1.0
6028
+ b NaN
6029
+ d 1.0
6030
+ e NaN
6031
+ dtype: float64
6032
+ >>> a.multiply(b, fill_value=0)
6033
+ a 1.0
6034
+ b 0.0
6035
+ c 0.0
6036
+ d 0.0
6037
+ e NaN
6038
+ dtype: float64
6039
+ >>> a.mul(5, fill_value=0)
6040
+ a 5.0
6041
+ b 5.0
6042
+ c 5.0
6043
+ d 0.0
6044
+ dtype: float64
6045
+ """
5984
6046
return self ._flex_method (
5985
6047
other , operator .mul , level = level , fill_value = fill_value , axis = axis
5986
6048
)
0 commit comments