pandas.Series.mul

Return Multiplication of series and other, element-wise (binary operator mul).

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 value 0.

  • Parameters level and fill_value are supported only with default value None.

Examples

Element-wise multiplication of two Series
import pandas as pd
from numba import njit


@njit
def series_mul():
    s1 = pd.Series([1, 3, 100])
    s2 = pd.Series([0, 1, 2])
    out_series = s1.mul(s2)

    return out_series  # Expect series of 0, 3, 200


print(series_mul())
$ python ./series/series_mul.py
0      0
1      3
2    200
dtype: int64

See also

Series.rmul