pandas.Series.combine

Series.combine(other, func, fill_value=nan) [source]

Perform elementwise binary operation on two Series using given function with optional fill value when an index is missing from one Series or the other

Parameters:
other : Series or scalar value

func : function

Function that takes two scalars as inputs and return a scalar

fill_value : scalar value
Returns:
result : Series

See also

Series.combine_first
Combine Series values, choosing the calling Series’s values first

Examples

>>> s1 = Series([1, 2])
>>> s2 = Series([0, 3])
>>> s1.combine(s2, lambda x1, x2: x1 if x1 < x2 else x2)
0    0
1    2
dtype: int64

© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.23.4/generated/pandas.Series.combine.html